|
|
@@ -582,17 +582,31 @@ jobs:
|
|
|
|
|
|
metadata_file="${{ github.workspace }}/${{ steps.extract.outputs.file_name }}-metadata.json"
|
|
|
artifacts_api="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts?per_page=100"
|
|
|
- artifacts_json="$(curl --fail --silent --show-error \
|
|
|
- --header "Authorization: Bearer ${GH_TOKEN}" \
|
|
|
- --header "X-GitHub-Api-Version: 2022-11-28" \
|
|
|
- "$artifacts_api")"
|
|
|
|
|
|
resolve_artifact() {
|
|
|
local artifact_name="$1"
|
|
|
+ local all_artifacts="[]"
|
|
|
+ local page=1
|
|
|
+ local has_more=true
|
|
|
+
|
|
|
+ while [ "$has_more" = "true" ]; do
|
|
|
+ page_content="$(curl --fail --silent --show-error --location \
|
|
|
+ --header "Authorization: Bearer ${GH_TOKEN}" \
|
|
|
+ --header "X-GitHub-Api-Version: 2022-11-28" \
|
|
|
+ "${artifacts_api}&page=${page}")"
|
|
|
+ all_artifacts="$(jq -cn --argjson acc "$all_artifacts" --argjson cur "$page_content" \
|
|
|
+ '$acc + $cur.artifacts')"
|
|
|
+ items="$(jq '(.artifacts | length) // 0' <<<"$page_content")"
|
|
|
+ if [ "$items" -lt 100 ]; then
|
|
|
+ has_more=false
|
|
|
+ fi
|
|
|
+ page=$((page + 1))
|
|
|
+ done
|
|
|
+
|
|
|
local matches
|
|
|
matches="$(jq --arg name "$artifact_name" \
|
|
|
'[.artifacts[] | select(.name == $name and .expired == false)]' \
|
|
|
- <<<"$artifacts_json")"
|
|
|
+ <<<"{\"artifacts\": $all_artifacts}")"
|
|
|
if [ "$(jq 'length' <<<"$matches")" -ne 1 ]; then
|
|
|
echo "Expected exactly one available artifact named ${artifact_name}." >&2
|
|
|
exit 1
|