Skip to content

Instantly share code, notes, and snippets.

@davidxia
Last active June 19, 2018 16:03
Show Gist options
  • Save davidxia/44171398798f260c891be817f2afd501 to your computer and use it in GitHub Desktop.
Save davidxia/44171398798f260c891be817f2afd501 to your computer and use it in GitHub Desktop.
close all open github PRs in one line with httpie, graphql API, jq, and fish shell
http https://ghe.spotify.net/api/graphql "Authorization: Bearer $github_access_token" query='{
user(login: "davidxia") {
pullRequests(first: 100, states: OPEN) {
totalCount
nodes {
number
repository {
name
owner {
login
}
}
}
}
}
}' | jq -r '.data.user.pullRequests.nodes[] | "/" + .repository.owner.login + "/" + .repository.name + "/pulls/" + (.number|tostring)' | xargs -n 1 -I @ http PATCH $github_api_base_url/repos@ state=closed "Authorization: Bearer $github_access_token" --ignore-stdin --print hH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment