Last active
June 19, 2020 20:16
-
-
Save madchap/dbbd1e18707215f1444178a0dc928419 to your computer and use it in GitHub Desktop.
GitHub graphQL PR query
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
#!/usr/bin/env bash | |
set -e | |
set -o pipefail | |
OUTPUT=$(curl -s --location --request POST 'https://api.github.com/graphql' \ | |
--header "Authorization: Bearer $GH_TOKEN" \ | |
--header 'Content-Type: application/json' \ | |
--data-raw '{"query":"{\n search(first: 50, query: \"repo:DefectDojo/django-DefectDojo is:pr is:merged created:2020-03-12..2020-04-11\", type: ISSUE) {\n nodes {\n ... on PullRequest {\n number\n title\n url\n author { login }\n }\n }\n }\n}","variables":{}}') | |
echo "$OUTPUT" | jq -r '.data.search.nodes[] | [.number, .author.login, .title, .url] |@csv' | tr -d \" | awk -v FS="," 'BEGIN{OFS="\n";}{printf "- %s @%s [#%i](%s)\n",$3,$2,$1,$4}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment