Skip to content

Commit 17390dc

Browse files
committed
fix(ci): resolve dev-version via artifacts API, not run-list walk
The resolve-dev-version step in release-readiness.yml walked the last 10 successful dev-publish.yml runs probing each for a dev-version artifact. But most dev-publish runs are no-ops (the check-changes gate skips version/build/publish when there are no new commits) and still report as success, so a fixed-size run window regularly misses the most recent real publish — exactly what happened on run 25742371117, where the actual publish landed 6 minutes later. Switch to GET /actions/artifacts?name=dev-version, which is sorted newest-first and only returns runs that actually uploaded the artifact. One API call instead of up to 11. Also correctly skips expired artifacts.
1 parent 04ef183 commit 17390dc

1 file changed

Lines changed: 13 additions & 23 deletions

File tree

‎.github/workflows/release-readiness.yml‎

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,21 @@ jobs:
5454
GH_REPO: ${{ github.repository }}
5555
run: |
5656
set -euo pipefail
57-
# Walk recent successful runs and pick the first one that actually
58-
# uploaded a 'dev-version' artifact. The check-changes gate skips the
59-
# version job (and so the upload) when there are no new commits, but
60-
# such runs still complete as success — those must be ignored.
61-
mapfile -t candidates < <(gh run list \
62-
--workflow dev-publish.yml \
63-
--branch main \
64-
--status success \
65-
--limit 10 \
66-
--json databaseId \
67-
--jq '.[].databaseId')
68-
69-
run_id=""
70-
for candidate in "${candidates[@]}"; do
71-
if gh api "repos/${GH_REPO}/actions/runs/${candidate}/artifacts" \
72-
--jq '.artifacts[].name' \
73-
| grep -qx "dev-version"; then
74-
run_id="${candidate}"
75-
break
76-
fi
77-
echo "Run ${candidate} has no dev-version artifact; trying older run"
78-
done
57+
# Query the artifacts API directly instead of walking workflow runs.
58+
# Many dev-publish runs are no-ops (the check-changes gate skips
59+
# version/build/publish when there are no new commits) but still
60+
# report as success, so a fixed-size run window can miss the most
61+
# recent real publish. The artifacts API is sorted newest-first and
62+
# only returns runs that actually uploaded the artifact.
63+
run_id=$(gh api \
64+
"repos/${GH_REPO}/actions/artifacts?name=dev-version&per_page=20" \
65+
--jq '[.artifacts[]
66+
| select(.expired == false)
67+
| select(.workflow_run.head_branch == "main")
68+
][0].workflow_run.id // empty')
7969
8070
if [ -z "$run_id" ]; then
81-
echo "::error::No recent successful 'Dev Build & Publish' run on main has a 'dev-version' artifact"
71+
echo "::error::No non-expired 'dev-version' artifact on main"
8272
exit 1
8373
fi
8474
echo "run_id=${run_id}" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)