From 6adae09f128d2b02bd6e5bdb4e52edabfe87d3f3 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 09:51:48 +0000 Subject: [PATCH] [ci] Add /pr-as-claude slash command --- .claude/commands/pr-as-claude.md | 24 ++++++++++++++++++++++++ .gitignore | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .claude/commands/pr-as-claude.md diff --git a/.claude/commands/pr-as-claude.md b/.claude/commands/pr-as-claude.md new file mode 100644 index 0000000000..a9225e8520 --- /dev/null +++ b/.claude/commands/pr-as-claude.md @@ -0,0 +1,24 @@ +--- +description: Open a PR authored by claude[bot] through the open-pr job in claude.yaml +argument-hint: "[branch] [base]" +--- + +Open a pull request as claude[bot] instead of as Chris. Only do this because this command was run; every other PR still opens under Chris's account. + +Arguments: `$ARGUMENTS` +- First argument is the head branch. Default: the current branch (`git branch --show-current`). +- Second argument is the base branch. Default: `master`. + +Steps: + +1. Make sure the head branch exists on `origin` and is up to date (`git ls-remote --heads origin `). If it isn't pushed, push it with `git push -u origin `. Stop if the branch is `master` or if a PR is already open for it (`gh pr list --head --state open`). +2. Write a title and body from the commits on `..`, matching the style of recent PRs (`[area] Short summary` title, a short body saying what changed). No attribution, signatures or session links. +3. Dispatch the workflow. The `open-pr` job runs `gh pr create` with the Claude app's token, which is what makes claude[bot] the author: + + ``` + gh workflow run claude.yaml --ref master -f head= -f base= -f title="" -f body="<body>" -f draft=true + ``` + + If `gh` isn't available, use the GitHub MCP `actions_run_trigger` tool with the same workflow, ref and inputs. +4. Find the run (`gh run list --workflow claude.yaml --event workflow_dispatch --limit 1 --json databaseId,status`) and wait for it with `gh run watch <id> --exit-status`. +5. Report the PR URL and confirm its author is `claude[bot]` (`gh pr list --head <branch> --json url,author`). If the run failed or no PR exists, show the failing step from `gh run view <id> --log-failed`. diff --git a/.gitignore b/.gitignore index 11f8830313..7923952714 100644 --- a/.gitignore +++ b/.gitignore @@ -95,7 +95,8 @@ build/ !.vscode/*.code-snippets # agents -.claude/ +.claude/* +!.claude/commands/ .context/ PLAN.md TASK.md