Run Pull Request Commands
The webhook server reacts to slash commands posted as pull request comments. Comment /wip on a PR and the server
adds the wip label and prefixes the title with WIP:.
How commands are recognized
- Only comments created on a PR are processed. Editing or deleting a comment does nothing.
-
Every line of the comment that starts with
/is treated as a command. The leading/is stripped, the first word is the command, and the rest is the argument. -
Several commands can be posted in a single comment — each line is one command, and they run concurrently.
- A command argument of exactly
cancelturns the command into a removal (/wip cancel). - The server reacts with a 👍 to the comment once a command is accepted.
- Comments containing the server's own welcome-message URL are ignored, so the bot never processes its own output.
- Unknown commands are silently ignored (logged only).
Example — one comment, three commands:
/wip
/assign-reviewers
/retest tox
Who can run what
| Who | Meaning |
|---|---|
| Author | The user who opened the pull request |
| Approver | A repository collaborator/contributor, an approver listed in OWNERS, a maintainer, or anyone an effective maintainer or root OWNERS approver has granted with /add-allowed-user @user |
| Maintainer | Listed in the root-approvers configuration, or a direct repository collaborator with admin or maintain permission (org owners and members with access only via org base permissions or teams do not count) |
| Effective maintainer | Anyone GitHub reports with admin or maintain permission on the repository — org owners/admins and team-inherited admins included, direct collaborators not required |
| Anyone | Any user who can comment, no permission check |
| Command | What it does | Who can run it |
|---|---|---|
/wip |
Adds the wip label and prefixes the title with WIP: |
Author, Approver |
/wip cancel |
Removes the wip label and strips the WIP: prefix from the title |
Author, Approver |
/verified |
Adds the verified label and sets the verified check run to success |
Author, Approver |
/verified cancel |
Removes the verified label and re-queues the verified check run |
Author, Approver |
/hold |
Adds the hold label, blocking the merge |
Author, Approver |
/hold cancel |
Removes the hold label |
Author, Approver |
/lgtm |
Adds the lgtm-<user> label and removes that user's changes-requested-<user> |
Anyone (ignored on your own PR) |
/lgtm cancel |
Removes the lgtm-<user> label |
Anyone (ignored on your own PR) |
/approve |
Adds approved-<user>, removes changes-requested-<user>, and triggers the AI test oracle |
Approver |
/approve cancel |
Removes approved-<user> |
Approver |
/automerge |
Adds the automerge label; the PR merges automatically once all requirements are met |
Maintainer, Approver, Effective maintainer |
/automerge cancel |
Removes the automerge label |
Maintainer, Approver, Effective maintainer |
/retest <test> |
Re-runs one or more configured checks | Approver |
/retest all |
Re-runs every check configured for the repository | Approver |
/reprocess |
Re-runs the complete PR processing workflow from scratch | Approver |
/rebase |
Rebases the PR branch onto its base branch and force-pushes | Approver, Effective maintainer |
/assign-reviewers |
Assigns reviewers according to the repository OWNERS file |
Approver |
/assign-reviewer @user |
Requests a review from a specific collaborator | Approver |
/add-allowed-user @user |
Grants an arbitrary commenter permission to run approver commands | Effective maintainer, root OWNERS approver |
/check-can-merge |
Runs the can-be-merged check and reports the merge blockers |
Approver |
/merge |
Merges the PR immediately if can-be-merged is green (one-time, no label; method via merge-command-method, default squash; opt-in via allow-merge-command) |
Effective maintainer, root OWNERS approver, or approver of every matched OWNERS dir |
/build-and-push-container |
Builds and pushes the container image for the PR | Anyone |
/cherry-pick <branch> [branch...] |
Cherry-picks the PR to one or more target branches | Approver |
/cherry-pick-retry <branch> |
Retries a failed cherry-pick on a merged PR | Approver |
/regenerate-welcome |
Re-renders the welcome comment with the current configuration | Approver |
/test-oracle |
Runs the built-in PR Test Oracle to recommend tests for the PR | Approver |
/security-override |
Sets the security check runs to success | Effective maintainer, root OWNERS approver |
/security-override cancel |
Re-runs the security checks to re-evaluate them | Effective maintainer, root OWNERS approver |
Arguments must match exactly
A command accepts only the arguments listed in the table above. Commands whose only argument is cancel refuse any
other trailing text: /wip please is answered with `/wip` takes no arguments other than `cancel` and nothing
runs — no label, no check, no build, no rebase. A command that needs an argument but gets none, or gets one it does not
accept, is refused with that command's own message. A line that merely mentions a command inline is not executed:
only lines starting with / are commands, one per line.
Commands on draft pull requests
Draft PRs are blocked by default. The allow-commands-on-draft-prs configuration key controls the exception list.
Note: /merge is never allowed on draft PRs — it is rejected even when listed in allow-commands-on-draft-prs.
Set it in config.yaml, either globally or under repositories.<repo> to override the global default for a single
repository:
# config.yaml
repositories:
owner/repo-name:
allow-commands-on-draft-prs:
- build-and-push-container
- retest
This key is read from config.yaml only. Unlike most other settings, it is not read from a repository-local
.github-webhook-server.yaml — placing it there has no effect and draft PRs stay blocked.
| Value | Behaviour |
|---|---|
| Not set (default) | All commands are blocked on draft PRs |
[] (empty list) |
All commands are allowed on draft PRs |
["retest", "wip"] |
Only the listed commands are allowed; any other command is rejected with a comment naming the allowed ones |
/test-oracle is the one exception to the per-command allowlist — it runs on a draft PR even when it is not listed in
allow-commands-on-draft-prs. That exception only applies when the key is set, even to an empty list. If the key is
absent, the draft pull request is dropped before any command is evaluated, so /test-oracle does not run either.
Command details
PR status
/wip and /wip cancel
Marks the PR as work in progress. /wip adds the wip label and prepends WIP: to the title if the prefix is not
already there. /wip cancel removes the label and strips the prefix (both WIP: and WIP: are handled).
/wip
/wip cancel
Available to the PR author and approvers. A user who is neither is ignored.
/verified and /verified cancel
Marks the change as reviewed and verified. /verified also sets the verified check run to success;
/verified cancel removes the label and puts the verified check run back to queued so it runs again.
/verified
/verified cancel
Available to the PR author and approvers.
/hold and /hold cancel
hold blocks the pull request from merging until it is removed. Because it is merge-blocking, it is narrower than
/wip and /verified: only the PR author and pull request approvers can set or clear it. Anyone else gets a comment
explaining that only the author or approvers may manage the label.
/hold
/hold cancel
Review and approval
/lgtm and /lgtm cancel
Records "looks good to me" for the commenting user by adding the lgtm-<user> label and removing that user's
changes-requested-<user> label. Any commenter may use it; if the commenter is the PR author, the command is ignored
so you cannot lgtm your own pull request.
/lgtm
/lgtm cancel
/approve and /approve cancel
Records a formal approval by adding approved-<user> and removing changes-requested-<user>. Only users in the
OWNERS approver list (or root approvers) are accepted; a non-approver's /approve is silently ignored.
A successful /approve also kicks off the PR Test Oracle in the background, if it is configured.
/approve
/approve cancel
/automerge and /automerge cancel
/automerge adds the automerge label. Once the label is present and every merge requirement is satisfied, the server
merges the PR on its own. /automerge cancel removes the label.
/automerge
/automerge cancel
Both accept maintainers, every approver in the repository, and effective maintainers; anyone else gets the comment "Only maintainers or approvers can set pull request to auto-merge".
No approver loses access: the approver path is unchanged, so /automerge still works for anyone who was already an
approver of the repository OWNERS files. The effective-maintainer rule only adds people GitHub reports as having
admin or maintain permission — org owners and team-inherited admins included, direct collaboration not required.
/assign-reviewers
Assigns reviewers to the pull request based on the OWNERS file in the repository.
/assign-reviewers
/assign-reviewer @username
Requests a review from one specific user. The target must be a repository collaborator, otherwise the server comments that the user is not a collaborator.
/assign-reviewer @octocat
/check-can-merge
Evaluates the merge requirements and reports which ones are still blocking the merge.
/check-can-merge
/merge
Merges the PR immediately, without adding the automerge label, if the can-be-merged check run on the current
head commit is green. It is a one-time action: the merge eligibility is evaluated only at the moment the command is
sent. If can-be-merged is not green, the server comments that the PR cannot be merged and does nothing else — no
label is added and no future merge is armed. Send /merge again once the check is green. The merge is pinned to the
head commit whose can-be-merged run was validated — the PR head is re-verified from GitHub at command time, and
if new commits were pushed, or the base branch advances
before the merge lands, the merge is rejected and the server tells you to re-run /check-can-merge and send /merge
again once it is green. Only check runs created by the server's own GitHub App count as the can-be-merged
verdict — a job on the PR branch named can-be-merged cannot unlock the merge. Required labels
(can-be-merged-required-labels) are re-verified at merge time, so removing a required label after the check passed
blocks the merge. The PR is merged with the method configured via merge-command-method
(squash, merge, or rebase; default: squash, see
Configuration reference). /merge takes no arguments (/merge cancel is rejected).
/merge is gated by two things. First, every OWNERS entry matching the changed files must set
root-approvers: false (see
Set up owners and reviewers). If any matched entry lacks the opt-out, or a changed
folder has no matching sub-OWNERS, the command is rejected for every sender — maintainers included. For changes
under a dot-directory (e.g. .github/workflows/) that sub-OWNERS only counts if the root OWNERS lists the
dot-directory in dot-folders.
Second, the sender must be authorized to merge that PR. That holds for:
-
an effective maintainer — anyone GitHub reports with
adminormaintainpermission, org owners and team-inherited admins included — whether or not they approve the matchedOWNERSdirs; -
a root
OWNERSapprover — an approver listed in the repository root.OWNERSfile — on the same terms; - otherwise an approver of every
OWNERSdir covering the changed files, sub-directory and SIG approvers included. This path is unchanged, so a repository with no maintainers can still merge its own pull requests through its own approvers, and a PR touching dirs the sender cannot approve is not mergeable by them.
Anyone else is rejected with a comment explaining the requirement — for the approver case, naming the dirs the sender does not cover. It is not allowed on draft PRs.
/merge is opt-in: it works only when allow-merge-command: true is set in the server
configuration — globally or for the specific repository (see
Configuration reference); the repository-local
.github-webhook-server.yaml cannot enable it. When not set, the command is rejected
with a comment saying it is not enabled for the repository.
/merge
/add-allowed-user @username
Lets an effective maintainer or a root OWNERS approver grant command permission to someone who is not otherwise a
collaborator — for example an external contributor working on a PR. The grant is per pull request: the server looks for
a comment containing /add-allowed-user @username whose author is an effective maintainer or a root OWNERS
approver.
/add-allowed-user @external-contributor
Vouching follows the same rule as /security-override: "root OWNERS approver" means an approver listed in the
repository root . OWNERS file. An approver listed only in a sub-directory OWNERS file can no longer vouch for a
user repo-wide, and a user who was granted access this way cannot pass the grant on. The server still replies
"@external-contributor is now allowed to run commands" to any /add-allowed-user comment, so that reply alone does
not mean the grant takes effect.
The user can then run approver-level commands such as /retest or /reprocess on that PR.
Testing and validation
/retest <test> [test...] and /retest all
Re-runs one or more checks. The test name is required — /retest with no argument gets a
"retest requires an argument" comment. Unknown names get a "No <name> configured for this repository" comment; the
valid ones still run.
Supported names depend on the repository configuration:
| Test name | Runs |
|---|---|
tox |
The Python test suite |
build-container |
Rebuilds and tests the container image |
python-module-install |
Tests installing the Python package |
pre-commit |
Runs pre-commit hooks and checks |
conventional-title |
Validates the commit message format |
| custom check-run names | Any check run defined in custom-check-runs |
/retest tox
/retest tox pre-commit
/retest all
all cannot be combined with other names — /retest all tox is rejected with
"Invalid command. all cannot be used with other tests".
/build-and-push-container
Builds the container image for the PR and pushes it, tagged with the PR number. Extra build arguments are supported:
/build-and-push-container
/build-and-push-container --build-arg KEY=value
Build-arg values may use the same placeholders as container.build-args — {revision}, {tag}, {created}, {repo}, {pr_number} — substituted with plain string replacement, never a shell.
If the repository has no container build configured, the server replies "No build-and-push-container configured for this repository". No permission check is applied.
/test-oracle
Runs the built-in PR Test Oracle via the local AI sidecar to analyse the diff and post test recommendations on the PR.
Requires test-oracle to be configured (with ai-provider and ai-model). Runs in the background, so the command returns
immediately.
/test-oracle
This command is also the only one that bypasses the draft-PR block.
Branch management and cherry-picks
/rebase
Rebases the PR head branch onto its base branch and force-pushes the result.
/rebase
Restrictions enforced by the server:
- The PR must be open.
- Fork PRs are rejected — the head branch lives in another repository, so the force-push cannot be scoped to this repo.
-
For bot-owned PRs (such as cherry-pick PRs) the requester must be the cherry-pick initiator (the PR assignee) or an effective maintainer.
-
For user-owned PRs the requester must be the PR owner or an effective maintainer.
/cherry-pick <branch> [branch...]
Cherry-picks the change to one or more target branches. Each branch that exists gets a cherry-pick-<branch> label.
/cherry-pick v1.0
/cherry-pick v1.0 v2.0
Behaviour depends on the PR state:
-
Unmerged PR — the labels are added as a to-do list. When the PR is merged, the server sees them and runs the cherry-picks.
-
Merged PR — the cherry-picks run immediately, one per target branch, and the labels act as an audit record of what was back-ported.
Branches that do not exist are reported in a comment and skipped. If a cherry-pick-<branch> label is already
present, that branch is skipped with a note to remove the label and run the command again to re-trigger it.
/cherry-pick-retry <branch>
Retries a cherry-pick that failed. Exactly one branch name is accepted. The command validates that:
- the PR is merged,
- the
cherry-pick-<branch>label already exists (otherwise it points you at/cherry-pick), - any existing cherry-pick PR created by the bot for that branch is closed, and
then re-runs the cherry-pick.
/cherry-pick-retry v1.0
Workflow control
/reprocess
Re-runs the complete pull request processing workflow from scratch: labels, checks, reviewers, and so on. Merged PRs are skipped.
/reprocess
/regenerate-welcome
Re-renders the welcome comment using the current server and repository configuration, editing the existing welcome comment if there is one and creating it if there is not. Useful after changing the configuration — the welcome message documents exactly which commands are active for the repository.
/regenerate-welcome
Security
/security-override and /security-override cancel
When the security checks (security-suspicious-paths, security-committer-identity) fail, an effective maintainer or a
root OWNERS approver can:
-
/security-override— set the security check runs to success, annotated with the maintainer's name and a reminder to usecancelto undo it. -
/security-override cancel— re-run both security checks so they are evaluated again from scratch.
/security-override
/security-override cancel
Only effective maintainers and root OWNERS approvers may use these — an org owner or team-inherited admin who is not
a direct collaborator qualifies. "Root OWNERS approver" means an approver listed in the repository root . OWNERS
file; approvers listed only in a sub-directory OWNERS file are not accepted, because the override applies to the whole
repository. Anyone else gets "Only maintainers can use /security-override". If neither security
check is enabled for the repository, the server replies "No security checks are enabled — nothing to override."
Generic label commands
In addition to the commands above, the server's user-facing labels can be set and cleared directly:
/verified
/verified cancel
Adding cancel removes the label instead of adding it. This is the same mechanism that powers /wip, /hold,
/verified, /lgtm, /approve, and /automerge — their permission rules are described in the tables above. Any
other label name, including needs-rebase, has-conflicts, can-be-merged, and size/*, is not accepted as a
command; those labels are managed by the server itself.