From dc7759fe91093af6fe2014e55b45f71918b0350b Mon Sep 17 00:00:00 2001 From: grenade Date: Fri, 12 Jun 2026 11:27:26 +0000 Subject: [PATCH] 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("@") 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 --- .gitea/workflows/poll-upstream.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/poll-upstream.yml b/.gitea/workflows/poll-upstream.yml index 1d3cb66..299aa2e 100644 --- a/.gitea/workflows/poll-upstream.yml +++ b/.gitea/workflows/poll-upstream.yml @@ -78,7 +78,8 @@ jobs: # executing would cancel it (concurrency cancel-in-progress) and restart # identical work — builds longer than the poll interval could never # 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 + # "@", hence the startswith match. - name: Check for in-flight release build id: inflight run: | @@ -86,7 +87,7 @@ jobs: --header "Authorization: token ${{ secrets.DISPATCH_TOKEN }}" \ --url "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/actions/runs?limit=50" \ | jq '[.workflow_runs[] - | select(.path | endswith("build-release.yml")) + | select((.path // "") | startswith("build-release.yml@")) | select(.status != "completed")] | length') echo "count=${count}" >> "$GITHUB_OUTPUT" echo "in-flight build-release runs: ${count}" @@ -170,7 +171,7 @@ jobs: --header "Authorization: token ${{ secrets.DISPATCH_TOKEN }}" \ --url "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/actions/runs?limit=50" \ | jq '[.workflow_runs[] - | select(.path | endswith("build-prerelease.yml")) + | select((.path // "") | startswith("build-prerelease.yml@")) | select(.status != "completed")] | length') echo "count=${count}" >> "$GITHUB_OUTPUT" echo "in-flight build-prerelease runs: ${count}"