From 40e4675e88a7bce81f6b93e25f36017849a2ea87 Mon Sep 17 00:00:00 2001 From: alexbelgium Date: Wed, 22 Jul 2026 07:45:08 +0200 Subject: [PATCH 1/2] fix(ci): scope revert-on-failure to the failing push's own commits revert-on-failure re-fetched master and reverted before..HEAD, but HEAD was the live tip of master, not the head of the failing push. When the updater bot pushes one addon per commit in quick succession, a single addon's build failure would sweep in every successful commit pushed while the revert job was still running and revert them too. Revert before..github.sha instead, and retry the push with a rebase in case master moves again before we push. --- .github/workflows/onpush_builder.yaml | 34 ++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/onpush_builder.yaml b/.github/workflows/onpush_builder.yaml index b58e380d8d..ee7c3d1fc9 100644 --- a/.github/workflows/onpush_builder.yaml +++ b/.github/workflows/onpush_builder.yaml @@ -407,20 +407,25 @@ jobs: fetch-depth: 0 - name: Revert commits from this failed push + env: + BEFORE: ${{ github.event.before }} + HEAD_SHA: ${{ github.sha }} run: | set -euo pipefail git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" - git fetch origin - git checkout master - git pull --ff-only origin master + git fetch origin master - before="${{ github.event.before }}" - if [ -n "$before" ] && [ "$before" != "0000000000000000000000000000000000000000" ]; then - mapfile -t commits < <(git rev-list "${before}..HEAD") + # Revert exactly the commits THIS push introduced (before..HEAD_SHA). + # Do not diff against the live master tip: concurrent pushes (e.g. the + # updater bot committing one addon per push) can land on master while + # this job is running, and a moving HEAD would sweep their unrelated, + # successful commits into the revert too. + if [ -n "$BEFORE" ] && [ "$BEFORE" != "0000000000000000000000000000000000000000" ]; then + mapfile -t commits < <(git rev-list "${BEFORE}..${HEAD_SHA}") else - commits=("${{ github.sha }}") + commits=("$HEAD_SHA") fi if [ "${#commits[@]}" -eq 0 ]; then @@ -428,8 +433,21 @@ jobs: exit 0 fi + git checkout -B master origin/master for commit in "${commits[@]}"; do git revert --no-edit "$commit" done - git push origin HEAD:master + # Master may have moved again since we fetched (e.g. another + # concurrent updater push), so retry the push with a rebase. + for attempt in 1 2 3 4 5; do + if git push origin HEAD:master; then + exit 0 + fi + echo "Push rejected, rebasing onto latest master (attempt ${attempt})" + git fetch origin master + git rebase origin/master + done + + echo "Failed to push reverts after retries" >&2 + exit 1 From 7d7ece7eab66ad33d37db23b02620e5776040877 Mon Sep 17 00:00:00 2001 From: alexbelgium Date: Wed, 22 Jul 2026 07:54:30 +0200 Subject: [PATCH 2/2] fix(ci): capture sanitize commit SHA, fail cleanly on rebase conflict Addresses review feedback on #2888 without widening the revert scope back to a moving target: - prebuild-sanitize's own [nobuild] commit lands on top of HEAD_SHA within the same run, so before..HEAD_SHA doesn't include it. It's still this push's own fallout, not a neighboring push's, so capture its SHA via job output and revert it explicitly (reverted first, since it's on top). - git rebase in the push-retry loop could conflict and get killed silently by set -e, burning the remaining retry attempts. Abort the rebase and fail loudly instead. --- .github/workflows/onpush_builder.yaml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/onpush_builder.yaml b/.github/workflows/onpush_builder.yaml index ee7c3d1fc9..4dead65853 100644 --- a/.github/workflows/onpush_builder.yaml +++ b/.github/workflows/onpush_builder.yaml @@ -55,6 +55,9 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + outputs: + sanitizeCommitted: ${{ steps.sanitize_commit.outputs.committed }} + sanitizeCommitSha: ${{ steps.sanitize_commit.outputs.commit_long_sha }} steps: - uses: actions/checkout@v7 with: @@ -90,6 +93,7 @@ jobs: uses: ymwymw/check-mixed-line-endings@v2 - name: Commit sanitize changes + id: sanitize_commit if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} uses: EndBug/add-and-commit@v10 with: @@ -410,6 +414,8 @@ jobs: env: BEFORE: ${{ github.event.before }} HEAD_SHA: ${{ github.sha }} + SANITIZE_COMMITTED: ${{ needs.prebuild-sanitize.outputs.sanitizeCommitted }} + SANITIZE_SHA: ${{ needs.prebuild-sanitize.outputs.sanitizeCommitSha }} run: | set -euo pipefail @@ -428,6 +434,15 @@ jobs: commits=("$HEAD_SHA") fi + # The prebuild-sanitize job may have pushed its own [nobuild] commit + # on top of HEAD_SHA earlier in this same run. It's still this push's + # own fallout (not a neighboring push's), so revert it explicitly by + # SHA rather than widening the range to "whatever is on master now." + # It must be reverted first, since it sits on top of HEAD_SHA. + if [ "$SANITIZE_COMMITTED" = "true" ] && [ -n "$SANITIZE_SHA" ]; then + commits=("$SANITIZE_SHA" "${commits[@]}") + fi + if [ "${#commits[@]}" -eq 0 ]; then echo "Nothing to revert." exit 0 @@ -446,7 +461,13 @@ jobs: fi echo "Push rejected, rebasing onto latest master (attempt ${attempt})" git fetch origin master - git rebase origin/master + if ! git rebase origin/master; then + git rebase --abort + echo "Rebase hit a real conflict against latest master; aborting" \ + "rather than pushing a partial/broken revert. This needs a" \ + "human to look at it." >&2 + exit 1 + fi done echo "Failed to push reverts after retries" >&2