Drop --paginate from nightly marker lookup

With --paginate, gh runs the jq aggregation per page and concatenates, so
sort_by | last ran per-page and extra workflow_dispatch runs could push past
per_page=100 and emit two URLs — which would break the curl download.

The artifacts API returns results newest-first, so the most recent marker is
always on page 1. Drop --paginate and take first(non-expired), which emits
exactly one URL (or none) by construction.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Eric Bailey
2026-06-17 17:46:49 -05:00
parent 22ef002e3f
commit 6e29591c34
+5 -2
View File
@@ -35,10 +35,13 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
# Find the most recent non-expired nightly-build-commit artifact and read its SHA
# The artifacts API returns results newest-first, so the most recent marker is on
# page 1 — no --paginate needed (which would run the jq aggregation per page and
# could emit multiple URLs). Take the first non-expired match.
prev=""
url=$(gh api --paginate \
url=$(gh api \
"repos/${GITHUB_REPOSITORY}/actions/artifacts?name=nightly-build-commit&per_page=100" \
--jq '[.artifacts[] | select(.expired == false)] | sort_by(.created_at) | last | .archive_download_url' \
--jq 'first(.artifacts[] | select(.expired == false)) | .archive_download_url' \
2>/dev/null || true)
if [ -n "$url" ] && [ "$url" != "null" ]; then
if curl -sSL -H "Authorization: Bearer $GH_TOKEN" -o marker.zip "$url" \