Last active
December 26, 2018 23:57
-
-
Save johnymontana/0a273aef7db0dd0bf1b22fd65e2cc914 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load repositories | |
UNWIND ["repositories_000001.json", "repositories_000002.json"] AS file | |
CALL apoc.load.json($baseURL + file) YIELD value | |
// only import public repos | |
WITH value AS repo WHERE repo.private = false | |
MERGE (r:Repository {url: repo.url}) | |
SET r += repo {.name, .description, .website, created_at: DateTime(repo.created_at)} | |
MERGE (u:User {url: repo.owner}) | |
MERGE (r)<-[:OWNS]-(u) | |
FOREACH (collab IN repo.collaborators | | |
MERGE (c:User {url: collab.user}) | |
MERGE (c)-[cr:COLLABORATES]->(r) | |
SET cr.permission = collab.permission | |
) | |
FOREACH (webhook IN repo.webhooks | | |
MERGE (w:Webhook {url: webhook.payload_url}) | |
MERGE (r)-[:HAS_WEBHOOK]->(w) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment