From ee2783b7b563fe1c46a078d268701041f2ba7ea9 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Oct 2026 23:39:15 +0000 Subject: [PATCH] Add an auto-merge skill: enable GitHub auto-merge on claude/* PRs, no chatter Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw --- .claude/skills/auto-merge/SKILL.md | 32 ++++++++++++++++++++++++++++++ CLAUDE.md | 5 +++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .claude/skills/auto-merge/SKILL.md diff --git a/.claude/skills/auto-merge/SKILL.md b/.claude/skills/auto-merge/SKILL.md new file mode 100644 index 0000000..cd857dc --- /dev/null +++ b/.claude/skills/auto-merge/SKILL.md @@ -0,0 +1,32 @@ +--- +name: auto-merge +description: After opening or being handed a pull request from a claude/* branch, turn on GitHub auto-merge so it merges when CI completes, and stay silent about it. Use whenever a PR is created, or when asked to auto-merge. Never merges anything that is not from a claude/* branch in this repo. +--- + +# Auto-merge when CI completes + +Use the GitHub MCP tools (`mcp__github__*`), never `gh`. **No chatter**: do not report PR status, CI progress, subscriptions +or merges, and do not answer PR events (opened, checks finished, merged, subscription notices). Speak only for the cases under +"Say something" below, in one line. + +## When +Right after a PR is opened from this session, or when a `claude/*` PR is pointed out to you. + +## Eligible PRs +Open, not a draft, head branch starts with `claude/` in this same repo, base is the default branch. Anything else: do nothing. + +## Steps +1. `enable_pr_auto_merge` with `mergeMethod: MERGE`. GitHub then merges it itself once the required `check` passes. Done: say nothing. +2. If that fails because the PR is already mergeable and the `check` run is already completed and successful + (`pull_request_read` `get_check_runs`), merge it now with `merge_pull_request`, `merge_method: merge`, and + `expectedHeadSha` set to the head SHA you just read. Say nothing. +3. Do not subscribe to the PR, and do not unsubscribe or comment. The user watches CI in the Claude Code CI button. + +## Say something (one line each) +- Auto-merge could not be enabled for any other reason (for example "Allow auto-merge" is off in the repo settings). +- CI failed and you cannot fix it, or the PR conflicts with `main` and the conflict is not a plain merge. + +## Never +- Merge or enable auto-merge on a PR from another branch, a fork, a draft, or one whose checks have failed or are missing. +- Skip, disable or re-run tests to get green; force-push; approve reviews; close PRs; delete branches. +- Turn auto-merge off for a PR the user switched it on for. diff --git a/CLAUDE.md b/CLAUDE.md index f1b0a66..72ef732 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,8 +7,9 @@ MCP data tools and web search. User-facing docs are in `README.md`; this file is - `make check`: ruff + pytest (no network, a few seconds). Run it before every commit, on Python 3.13.5 (production; `uv venv --python 3.13.5`). GitHub CI runs the latest stable Python and Node.js instead, to catch breakage from the next upgrade early. - `make prompt-report`: token breakdown of a sample request. `python bot.py [label]` runs the bot. -- Merging: tick "Auto-merge when ready" in the PR's CI button; GitHub merges once the required `check` passes (needs "Allow auto-merge" in - the repo settings and `check` as a required status on `main`). +- Merging: after opening a PR from a `claude/*` branch, follow `.claude/skills/auto-merge/SKILL.md`: enable GitHub auto-merge and say nothing + about it. It needs "Allow auto-merge" in the repo settings and `check` as a required status on `main`; the CI button's + "Auto-merge when ready" box does the same per PR. - Tests use fakes (`tests/conftest.py`: FakeBot, user_msg; `tests/fakes.py`: ScriptedBackend, FakeMcp, fake SDK clients; `tests/fixtures/` real anonymised MCP output). Add a test next to the module you change; don't write scratch scripts.