fix(poll): match run path with @ref suffix in in-flight guard
Gitea's runs API returns path as "build-prerelease.yml@refs/heads/main",
so endswith(".yml") never matched and the guard counted 0 with a build
demonstrably in flight (run 3230 was cancelled by the test dispatch).
Match on startswith("<file>@") instead, with a null-guard for runs
lacking the field. Verified against the live API: counts the in-flight
run correctly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,7 +78,8 @@ jobs:
|
|||||||
# executing would cancel it (concurrency cancel-in-progress) and restart
|
# executing would cancel it (concurrency cancel-in-progress) and restart
|
||||||
# identical work — builds longer than the poll interval could never
|
# identical work — builds longer than the poll interval could never
|
||||||
# finish. Skip dispatching and let the running build complete; the next
|
# finish. Skip dispatching and let the running build complete; the next
|
||||||
# poll re-checks the published RPMs.
|
# poll re-checks the published RPMs. Note: the runs API reports path as
|
||||||
|
# "<file>@<ref>", hence the startswith match.
|
||||||
- name: Check for in-flight release build
|
- name: Check for in-flight release build
|
||||||
id: inflight
|
id: inflight
|
||||||
run: |
|
run: |
|
||||||
@@ -86,7 +87,7 @@ jobs:
|
|||||||
--header "Authorization: token ${{ secrets.DISPATCH_TOKEN }}" \
|
--header "Authorization: token ${{ secrets.DISPATCH_TOKEN }}" \
|
||||||
--url "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/actions/runs?limit=50" \
|
--url "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/actions/runs?limit=50" \
|
||||||
| jq '[.workflow_runs[]
|
| jq '[.workflow_runs[]
|
||||||
| select(.path | endswith("build-release.yml"))
|
| select((.path // "") | startswith("build-release.yml@"))
|
||||||
| select(.status != "completed")] | length')
|
| select(.status != "completed")] | length')
|
||||||
echo "count=${count}" >> "$GITHUB_OUTPUT"
|
echo "count=${count}" >> "$GITHUB_OUTPUT"
|
||||||
echo "in-flight build-release runs: ${count}"
|
echo "in-flight build-release runs: ${count}"
|
||||||
@@ -170,7 +171,7 @@ jobs:
|
|||||||
--header "Authorization: token ${{ secrets.DISPATCH_TOKEN }}" \
|
--header "Authorization: token ${{ secrets.DISPATCH_TOKEN }}" \
|
||||||
--url "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/actions/runs?limit=50" \
|
--url "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/actions/runs?limit=50" \
|
||||||
| jq '[.workflow_runs[]
|
| jq '[.workflow_runs[]
|
||||||
| select(.path | endswith("build-prerelease.yml"))
|
| select((.path // "") | startswith("build-prerelease.yml@"))
|
||||||
| select(.status != "completed")] | length')
|
| select(.status != "completed")] | length')
|
||||||
echo "count=${count}" >> "$GITHUB_OUTPUT"
|
echo "count=${count}" >> "$GITHUB_OUTPUT"
|
||||||
echo "in-flight build-prerelease runs: ${count}"
|
echo "in-flight build-prerelease runs: ${count}"
|
||||||
|
|||||||
Reference in New Issue
Block a user