Install
openclaw skills install pr-auto-mergerAutonomous PR merge agent. Scans repos for approved + CI-passing PRs and merges them automatically. Supports dry-run mode, squash/merge options, and min-approval thresholds. Ideal for teams wanting hands-off PR cleanup.
openclaw skills install pr-auto-mergerAutonomous pull request merge tool. Scans GitHub repos for PRs that are approved, CI-passing, and mergeable — then merges them automatically (or reports in dry-run mode).
--squash (default) or --admin --merge--dry-run mode to preview what WOULD be merged without making changesgh — zero external dependenciesgh CLI authenticated (gh auth status)repo scope to merge# Preview what would be merged (default — safe)
python3 scripts/auto_merge.py owner/repo
# Actually merge
python3 scripts/auto_merge.py owner/repo --no-dry-run
# Require 2 approvals minimum, squash merge
python3 scripts/auto_merge.py owner/repo --min-approvals 2 --squash
# Scan multiple repos
python3 scripts/auto_merge.py owner/repo1 && python3 scripts/auto_merge.py owner/repo2
/pr-auto-merger owner/repo --dry-run
The agent will:
gh pr list --json--no-dry-runA PR is merged only when ALL of these are true:
isDraft: false)mergeable: true)statusCheckRollup conclusion: SUCCESS)APPROVED--min-approvals approvals (default: 1)Scanning owner/repo for mergeable PRs...
[DRY-RUN] Found 3 PR(s) ready to merge:
#123 — Fix auth middleware (https://github.com/owner/repo/pull/123)
#456 — Add caching layer (https://github.com/owner/repo/pull/456)
#789 — Update dependencies (https://github.com/owner/repo/pull/789)
Re-run with --no-dry-run to actually merge.
Drop this into a nightly cron job:
name: Nightly PR Merge
on:
schedule:
- cron: '0 6 * * *'
jobs:
merge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
pip install gh
gh auth status
python3 scripts/auto_merge.py owner/repo --no-dry-run --min-approvals 2
For OpenClaw scheduling, configure as:
{
"task": "python3 /path/to/scripts/auto_merge.py owner/repo --no-dry-run",
"schedule": "0 8 * * 1-5",
"notify_on": ["failure", "merged"]
}
scripts/auto_merge.py — Pure Python 3 (stdlib only)gh pr list --json for data fetchinggh pr merge for actual mergingMIT