mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 05:26:37 +00:00
Copy the current code for the yt-dlp
releases
This commit is contained in:
parent
5d3f75ea1c
commit
b619c5a42d
17
.github/actions/yt-dlp/action.yml
vendored
17
.github/actions/yt-dlp/action.yml
vendored
@ -28,6 +28,9 @@ inputs:
|
||||
Default: 'yt-dlp'
|
||||
|
||||
outputs:
|
||||
latest-release:
|
||||
value: ${{ steps.set.outputs.latest-release }}
|
||||
description: 'The JSON API response for the latest release.'
|
||||
releases:
|
||||
value: ${{ steps.set.outputs.releases }}
|
||||
description: 'Retrieved JSON from the API describing the releases.'
|
||||
@ -46,8 +49,8 @@ runs:
|
||||
run: |
|
||||
command -v gh > /dev/null ;
|
||||
command -v jq > /dev/null ;
|
||||
gql_query='query($repo: String!, $owner: String!, $releases: Int!, $assets: 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 } }, releaseAssets(first: $assets) { totalCount, nodes { name, size, downloadUrl } } } } } }' ;
|
||||
gql_jq='[ .data.repository.releases.nodes[] | select((.isLatest or .isDraft or .isPrerelease) | not) | { "tag": .tag.name, "commit": .tag.target.oid, "date": .tag.name[1+(.tag.name|index("-")):], "assets": { "limit": '"${GH_API_GQL_ASSETS}"', "totalCount": .releaseAssets.totalCount }, "files": .releaseAssets.nodes, "versions": [ .releaseAssets.nodes[].name | select(contains("-linux64-"))[1+index("-"):index("-linux64-")] ] } ]' ;
|
||||
gql_query='query($repo: String!, $owner: String!, $releases: Int!) { repository(owner: $owner, name: $repo) { releases(first: $releases, orderBy: { field: CREATED_AT, direction: DESC }) { nodes { name, createdAt, publishedAt, updatedAt, tagName, url, isDraft, isPrerelease, isLatest, tag { name, target { oid, commitUrl } } } } } }' ;
|
||||
gql_jq='[ .data.repository.releases.nodes[] | select((.isDraft or .isPrerelease) | not) | del(.isDraft, .isPrerelease) ]' ;
|
||||
mk_delim() { printf -- '"%s_EOF_%d_"' "$1" "${RANDOM}" ; } ;
|
||||
open_ml_var() { local f=''\%'s<<'\%'s\n' ; printf -- "${f}" "$2" "$1" ; } ;
|
||||
close_ml_var() { local f='%s\n' ; printf -- "${f}" "$1" ; } ;
|
||||
@ -61,6 +64,16 @@ runs:
|
||||
-F releases="${GH_API_GQL_RELEASES}" \
|
||||
-f query="${gql_query}" --jq "${gql_jq}" ;
|
||||
close_ml_var "${delim}" "${var}" ;
|
||||
jq_arg='map(select(.isLatest))[0]' ;
|
||||
var='latest-release' ;
|
||||
delim="$(mk_delim "${var}")" ;
|
||||
open_ml_var "${delim}" "${var}" ;
|
||||
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 -c "${jq_arg}" -- ;
|
||||
close_ml_var "${delim}" "${var}" ;
|
||||
unset -v delim jq_arg var ;
|
||||
} >> "${GITHUB_OUTPUT}" ;
|
||||
# Log the human version
|
||||
|
Loading…
Reference in New Issue
Block a user