Auto-merge #2056
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Auto-merge — nobody is in the merge loop. | |
| # | |
| # Green, ready PRs merge themselves and deploy themselves. The policy lives in | |
| # ONE place for the whole fleet — bitbaum/fleet, | |
| # scripts/ci/auto-merge-sweep.sh — and this file only says "run it, with these | |
| # settings". | |
| # | |
| # This repo held one of eight drifted copies of that script, and was one of the | |
| # last two converted: its copy re-armed CI so that CD (cd.yml, workflow_run on | |
| # CI) would ship the merge. That chain has a known hole — a CI run started by | |
| # GITHUB_TOKEN emits no workflow_run event, so CD never fires for an automated | |
| # merge. The canonical sweep closes it with a RECONCILER: every sweep compares | |
| # main's tip against the last successful cd.yml run and dispatches cd.yml | |
| # directly when they differ, so a deploy that never fired or fired and failed | |
| # is retried next sweep instead of sitting merged-but-not-live. | |
| # | |
| # The triggers stay here because they are genuinely per-repo: workflow_run must | |
| # name the CI workflow exactly. | |
| # | |
| # To stop all of this: delete this file, or add a `hold` label to a PR. | |
| name: Auto-merge | |
| on: | |
| workflow_run: | |
| workflows: ['CI'] | |
| types: [completed] | |
| schedule: | |
| - cron: '*/10 * * * *' | |
| workflow_dispatch: {} | |
| # Declared on the CALLER as well as inside the reusable workflow: a called | |
| # workflow's token is capped by what the caller grants, so relying on the | |
| # callee's block alone can hand it a read-only token — and the sweep would then | |
| # merge nothing while still exiting 0, which is indistinguishable from having | |
| # nothing to merge. | |
| permissions: | |
| contents: write # merge the PR | |
| pull-requests: write # read PR state, delete the branch | |
| actions: write # dispatch the re-arm and deploy workflows | |
| checks: read # statusCheckRollup — only load-bearing on private repos | |
| statuses: read | |
| jobs: | |
| sweep: | |
| uses: bitbaum/fleet/.github/workflows/auto-merge-sweep.yml@main | |
| with: | |
| base_branch: main | |
| ci_workflow: ci.yml | |
| # SPACE-separated: the sweep word-splits this. A comma would become one | |
| # bogus token, every dispatch would fail, and the only symptom would be | |
| # that nothing deploys — while the sweep still reported success. | |
| rearm_workflows: 'ci.yml' | |
| # The reconciler: ships main via cd.yml when the tip and the last | |
| # successful deploy differ. Without this, merges land and never ship. | |
| deploy_workflow: cd.yml |