Skip to content

Commit 8002268

Browse files
cliffhallclaude
andcommitted
docs(release): run the escape hatch's disable, merge and re-enable under one exit trap
Addresses Copilot round 3 on #5120. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent c9c6e0e commit 8002268

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

‎.claude/skills/release/SKILL.md‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,19 +293,39 @@ it, admins included. The only way through is a deliberate act by a repo
293293
admin: disable the `main: milestone merges only` ruleset for that one merge,
294294
and turn it straight back on.
295295

296+
The disable, the merge and the re-enable run as one command, in a subshell
297+
whose exit trap re-enables the ruleset however it ends: the merge failing, an
298+
error, or Ctrl-C. Approve the PR first; the other rulesets on `main` still
299+
require that.
300+
296301
```sh
302+
PR=<the release PR's number>
297303
RS=$(gh api repos/modelcontextprotocol/servers/rulesets \
298304
--jq '.[] | select(.name == "main: milestone merges only") | .id')
299305
[ -n "$RS" ] || echo "ruleset not found by name; list them and look" >&2
300-
gh api -X PUT "repos/modelcontextprotocol/servers/rulesets/$RS" -f enforcement=disabled
301-
# Merge the PR now, with "Create a merge commit". With the ruleset off,
302-
# squash and rebase are offered again; do not use them.
303-
gh api -X PUT "repos/modelcontextprotocol/servers/rulesets/$RS" -f enforcement=active
306+
[ -n "$RS" ] && (
307+
set -e
308+
restore() {
309+
gh api -X PUT "repos/modelcontextprotocol/servers/rulesets/$RS" \
310+
-f enforcement=active --jq '"ruleset: \(.enforcement)"'
311+
}
312+
trap restore EXIT
313+
trap 'exit 130' INT TERM HUP # exit, so the EXIT trap restores
314+
gh api -X PUT "repos/modelcontextprotocol/servers/rulesets/$RS" \
315+
-f enforcement=disabled >/dev/null
316+
# --merge: with the ruleset off, squash and rebase are allowed again.
317+
gh pr merge "$PR" --repo modelcontextprotocol/servers --merge
318+
)
304319
gh api "repos/modelcontextprotocol/servers/rulesets/$RS" --jq .enforcement # must print "active"
305320
```
306321
322+
A trap cannot run if the machine itself dies mid-command, so the last line
323+
is not optional: if it prints anything but `active`, set it back by hand
324+
(Settings → Rules → Rulesets) before doing anything else.
325+
307326
- **Only a human admin does this**, and only for a PR whose diff has been
308-
reviewed as the release. Never leave the ruleset disabled between steps.
327+
reviewed as the release. Never disable the ruleset outside the command
328+
above.
309329
- **Record it in the release ledger**: the PR, why it could not be a pure
310330
merge, and the times the ruleset was disabled and re-enabled.
311331
- **Then merge the release branch back into `v2/main`** through a PR of its

0 commit comments

Comments
 (0)