From ddd68c2824efdfa8cce9c310d58431679292d1f4 Mon Sep 17 00:00:00 2001 From: John Coffey Date: Wed, 30 Sep 2026 00:26:55 -0700 Subject: [PATCH] ci: a cancelled GitHub run no longer reports failure to Gitea The mirror can push one commit twice in quick succession. GitHub then starts two runs and cancels the older, and that run's report job posted "failure" for the commit. Gitea's github job, seeing the newest status, failed the check while the surviving run was still building and later passed. A cancelled run now posts nothing and leaves the result to the run that superseded it. A real failure still reports failure. --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72d8472..ebc32c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -194,8 +194,12 @@ jobs: - env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} CONTEXT: github/ci (${{ github.ref_type }}) - STATE: ${{ (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && 'failure' || 'success' }} + STATE: ${{ contains(needs.*.result, 'failure') && 'failure' || (contains(needs.*.result, 'cancelled') && 'cancelled' || 'success') }} run: | + # A cancelled run was superseded by a newer run for the same commit (the + # mirror can push one commit twice); that run reports. Posting "failure" + # here would fail the Gitea check while the real build is still going. + if [ "$STATE" = cancelled ]; then echo "cancelled: leaving the result to the newer run"; exit 0; fi jq -n --arg s "$STATE" --arg c "$CONTEXT" --arg u "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ '{state:$s, context:$c, target_url:$u, description:"GitHub Actions"}' | curl -fsS -o /dev/null -X POST -H "Authorization: token $GITEA_TOKEN" -H 'Content-Type: application/json' \ -- 2.54.0