Skip to content

Commit

Permalink
Merge pull request #337 from gm3dmo/graphqlrelease
Browse files Browse the repository at this point in the history
Adding a graphql script
  • Loading branch information
gm3dmo authored Feb 27, 2025
2 parents 32cb57a + be98ae7 commit 7d7864a
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions graphql-list-repository-release-assets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/graphql/reference/objects#repository

read -r -d '' graphql_script <<- EOF
{
search(type: REPOSITORY, query: "repo:$org/$repo", first: 1) {
nodes {
... on Repository {
id
databaseId
nameWithOwner
createdAt
isSecurityPolicyEnabled
isArchived
rulesets(first: 10) {
totalCount
nodes {
name
target
enforcement
}
}
releases(last: 1) {
totalCount
nodes {
tagName
releaseAssets(first: 100) {
totalCount
nodes {
name
size
createdAt
updatedAt
downloadUrl
contentType
downloadCount
uploadedBy { name }
}
}
}
}
}
}
}
}
EOF

graphql_script="$(echo ${graphql_script//\"/\\\"})"

curl ${curl_custom_flags} \
-H "Accept: application/vnd.github.v3+json" \
-H 'Accept: application/vnd.github.audit-log-preview+json' \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
${GITHUB_APIV4_BASE_URL} -d "{ \"query\": \"$graphql_script\"}"

0 comments on commit 7d7864a

Please sign in to comment.