From a5dc0ea5fbc314f0313283cc3a4a1771da0045a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Ign=C3=A1cio=20Fontoura=20Solla?= Date: Thu, 30 Jul 2026 04:55:15 -0300 Subject: [PATCH] =?UTF-8?q?ci:=20drop=20automerge=20fallback=20=E2=80=94?= =?UTF-8?q?=20GitHub=20Pro=20enables=20native=20auto-merge=20+=20branch=20?= =?UTF-8?q?protection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/automerge-stage.yml | 49 --------------------------- 1 file changed, 49 deletions(-) delete mode 100644 .github/workflows/automerge-stage.yml diff --git a/.github/workflows/automerge-stage.yml b/.github/workflows/automerge-stage.yml deleted file mode 100644 index 27ec3a84..00000000 --- a/.github/workflows/automerge-stage.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Auto-merge for PRs targeting `stage`. -# -# Why this exists: the repo is private on the GitHub Free plan, so native -# branch protection and native auto-merge are unavailable (both return 403 -# "Upgrade to GitHub Pro"). This workflow is the documented fallback: when a -# check run completes, it finds open PRs whose head SHA matches and whose base -# is `stage`, verifies EVERY check is green, and merges. If the repo is ever -# upgraded (or made public), delete this file and enable native protection + -# auto-merge on `stage` instead. -name: Auto-merge to stage - -on: - check_run: - types: [completed] - -permissions: - contents: write - pull-requests: write - checks: read - -concurrency: - group: automerge-stage-${{ github.event.check_run.head_sha }} - cancel-in-progress: false - -jobs: - merge: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v4 - - - name: Merge green stage PRs for this head SHA - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - HEAD_SHA: ${{ github.event.check_run.head_sha }} - run: | - set -euo pipefail - prs=$(gh pr list --state open --base stage --limit 50 --json number,headRefOid \ - --jq ".[] | select(.headRefOid == \"$HEAD_SHA\") | .number") - for pr in $prs; do - echo "Checking PR #$pr ($HEAD_SHA)" - # Fail (skip) if any check is not green. - if gh pr checks "$pr" --json name,state --jq '.[] | select(.state != "SUCCESS")' | grep -q .; then - echo "PR #$pr still has pending/failing checks — not merging." - continue - fi - gh pr merge "$pr" --merge --delete-branch=false - echo "Merged PR #$pr into stage." - done