Retrieve yt-dlp/yt-dlp releases from the GitHub API

This commit is contained in:
tcely 2025-03-26 12:23:52 -04:00 committed by GitHub
parent b799bdfd65
commit 0300be4728
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,6 +52,33 @@ jobs:
-F repo="${GH_API_GQL_REPO}" \ -F repo="${GH_API_GQL_REPO}" \
-F releases="${GH_API_GQL_RELEASES}" \ -F releases="${GH_API_GQL_RELEASES}" \
-f query="${gql_query}" --jq "${gql_jq}" | jq '.[]' -- ; -f query="${gql_query}" --jq "${gql_jq}" | jq '.[]' -- ;
- name: Retrieve yt-dlp/yt-dlp releases with GitHub CLI
id: yt-dlp
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_API_GQL_RELEASES: 25
GH_API_GQL_OWNER: yt-dlp
GH_API_GQL_REPO: yt-dlp
run: |
gql_query='query($repo: String!, $owner: String!, $releases: Int!) { repository(owner: $owner, name: $repo) { releases(first: $releases, orderBy: { field: CREATED_AT, direction: DESC}) { nodes { tagName, isDraft, isPrerelease, isLatest, tag { name, target { oid, commitUrl } } } } } }' ;
gql_jq='[ .data.repository.releases.nodes[] | select((.isDraft or .isPrerelease) | not) | { "tag": .tag, "date": .tag.name } ]' ;
{
var='releases' ;
delim='"'"${var}"'_EOF"' ;
printf -- '%s<<%s\n' "${var}" "${delim}" ;
gh api graphql --cache 12h \
-F owner="${GH_API_GQL_OWNER}" \
-F repo="${GH_API_GQL_REPO}" \
-F releases="${GH_API_GQL_RELEASES}" \
-f query="${gql_query}" --jq "${gql_jq}" ;
printf -- '%s\n' "${delim}" ;
unset -v delim jq_arg var ;
} >> "${GITHUB_OUTPUT}"
gh api graphql --cache 12h \
-F owner="${GH_API_GQL_OWNER}" \
-F repo="${GH_API_GQL_REPO}" \
-F releases="${GH_API_GQL_RELEASES}" \
-f query="${gql_query}" --jq "${gql_jq}" | jq '.[]' -- ;
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set outputs - name: Set outputs
id: set id: set