Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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\"}"