Skip to content

Instantly share code, notes, and snippets.

@lavoiesl
Last active August 17, 2018 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lavoiesl/671ede0c32bbe6244e968babe2b03a7c to your computer and use it in GitHub Desktop.
Save lavoiesl/671ede0c32bbe6244e968babe2b03a7c to your computer and use it in GitHub Desktop.
$ git log --since=2018-01-01 --pretty='%H %ae' | awk '{ users[$2] = $1 } END { for (u in users) { print users[u] } }' | sed -E 's/^(.+)$/object(oid: "\1") { ...author }/'
# c_9678fb4f85eeb6fd91a89caa255d7a80131a6fc5: object(oid: "9678fb4f85eeb6fd91a89caa255d7a80131a6fc5") { ...author }
curl -H "Authorization: token xxx" 'https://api.github.com/graphql' -X POST -d "{\"query\":\"$(sed 's/"/\\\\\\"/g' users.graphql | xargs echo)\"}" > output.json
{
"data": {
"repository": {
"c_9678fb4f85eeb6fd91a89caa255d7a80131a6fc5": {
"author": {
"user": {
"login": "someone"
}
}
},
...
}
}
}
query {
repository(owner: "Shopify", name: "shopify") {
c_9678fb4f85eeb6fd91a89caa255d7a80131a6fc5: object(oid: "9678fb4f85eeb6fd91a89caa255d7a80131a6fc5") { ...author }
c_a35c31bd37d16b1ecb54d5d7a534616d3bb8d7d8: object(oid: "a35c31bd37d16b1ecb54d5d7a534616d3bb8d7d8") { ...author }
...
}
}
fragment author on GitObject {
... on Commit {
author {
user {
login
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment