diff --git a/.github/workflows/onpush_builder.yaml b/.github/workflows/onpush_builder.yaml index db0b4fe07..72b67adc6 100644 --- a/.github/workflows/onpush_builder.yaml +++ b/.github/workflows/onpush_builder.yaml @@ -203,3 +203,22 @@ jobs: pull: --rebase --autostash fetch: --force push: --force + + # 6. Revert if workflow fails + revert-on-failure: + if: failure() + needs: [detect-changed-addons, prebuild-sanitize, lint_config, build, make-changelog] + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Revert the triggering commit + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + git revert --no-commit ${{ github.sha }} + git commit -m "Revert '${{ github.event.head_commit.message }}' [nobuild]" + git push origin master