Last active
June 19, 2018 16:03
-
-
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
This file contains 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
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