name: merge-pr description: Merge a GitHub pull request by number using squash merge argument-hint: "[pr-number]" allowed-tools: Bash(gh *, git *)
Merge a GitHub pull request.
- If
$ARGUMENTSis provided, use it as the PR number. Otherwise, rungh pr view --json numberto get the PR for the current branch. - Run
gh pr view <number> --json title,state,mergeableto verify the PR is open and mergeable - If the PR is not mergeable, inform the user and stop
- Merge using
gh pr merge <number> --squash - Run
git checkout master && git pull --pruneto update local master and clean up stale remote-tracking branches - Report the result to the user