Skip to content

ci: auto-merge a bot-opened PR once a person labels it automerge - #37

Merged
hsinatfootprintai merged 1 commit into
mainfrom
ci/automerge-bot-prs
Oct 27, 2026
Merged

hsinatfootprintai merged 1 commit into
mainfrom
ci/automerge-bot-prs

Conversation

@hsinatfootprintai

Copy link
Copy Markdown
Contributor

Lets a person approve a bot-opened pull request for automatic merge with one label.

What it does

When the label automerge is added to a pull request authored by containarium-ci[bot], this workflow runs gh pr merge --auto --squash on it. GitHub then merges the PR as soon as the branch's required status checks pass (today go, proto, web). The workflow never merges anything itself.

Guards

  • A person decides: only the automerge label starts it, so each merge stays a deliberate human act (one click), and the label can be removed or the auto-merge cancelled before checks finish.
  • Only the bot's PRs: the author must be containarium-ci[bot].
  • No workflow changes: a PR that touches anything under .github/ is refused (exit 1); a person merges those, because a workflow can read secrets and run with the repository token.
  • Cannot be changed by the PR it merges: it uses pull_request_target, so the workflow definition comes from main, and it checks out no PR code.
  • Least privilege: contents: write and pull-requests: write only, which GitHub requires to enable auto-merge.

Known limitation

A merge that GitHub performs for auto-merge enabled with the workflow's GITHUB_TOKEN does not trigger push workflows on main (GitHub does not start workflows from events caused by that token). The checks already ran on the pull request, but the ci run on the merge commit will not start by itself. If that matters, use a token from a GitHub App or a PAT for GH_TOKEN.

Not changed here

Branch protection is unchanged. Making e2e a required check is a separate step after the e2e workflow (#35) is on main, and needs that workflow's paths filter removed first: a required check that a path filter skips leaves a PR stuck waiting for it.

🤖 Generated with Claude Code

A labeled pull request authored by the Containarium bot gets GitHub's squash
auto-merge enabled; GitHub merges it once the required status checks pass. A
pull request that touches .github/ is refused. The workflow runs from the base
branch (pull_request_target) and checks out no PR code.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@hsinatfootprintai
hsinatfootprintai merged commit e204fb2 into main Oct 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant