guide~20 min read

OpenClaw + GitHub: Automate PRs, Issues, and Code Review

GitHub is where most development work lives. This guide covers how to connect OpenClaw to your repos and set up automated PR review, issue triage, CI monitoring, and changelog generation. Each workflow is a copy-paste HEARTBEAT.md or SOUL.md.

Step 1: Set up gh CLI auth

All GitHub workflows use the github skill, which wraps the gh CLI. Install the skill first, then authenticate.

# Install the github skill
clawhub install github

# Authenticate with GitHub
gh auth login

# Choose: GitHub.com, HTTPS, authenticate via browser
# Or paste a personal access token

# Verify authentication
gh auth status

# Test access to your repos
gh repo list --limit 5

The gh CLI authenticates once and stores a token. Your agent uses this token automatically. You do not need to pass credentials in your SOUL.md or HEARTBEAT.md.

Token scopes needed: The default gh auth login grants the right scopes. If you use a personal access token instead, you need: repo, read:org, and workflow.

Automated PR Review

The PR Reviewer runs every 2 hours during business hours. It checks for PRs created in the last 2 hours, reads the diff, and posts a review comment with a summary of what changed, potential issues, and suggestions.

This is not a replacement for human code review. It is a first pass. The agent catches obvious issues (missing error handling, large surface area changes, unclear naming) and summarizes context so the human review takes less time.

HEARTBEAT.md
Every 2 hours during business hours (9am-6pm):
1. Check for new PRs: gh pr list --state open --json number,title,author,createdAt
2. For PRs created in the last 2 hours, review the diff
3. Post a summary comment with: what changed, potential issues, suggested improvements
4. Send a Telegram notification with the PR link and your assessment

What a PR review comment looks like:

Agent Review: PR #142 — Add user export feature

What changed: Adds a CSV export endpoint at /api/users/export. Reads all users from the DB and streams a CSV response. Uses the existing auth middleware.

Potential issues:
• No pagination — will load all users into memory. Could fail for large datasets.
• No rate limiting on the export endpoint.
• PII fields (email, phone) exported without audit log.

Suggestions:
• Add a row limit or pagination parameter.
• Consider adding to the audit log for compliance.

Automated Issue Triage

The Issue Triage workflow checks for new unlabeled issues every hour. It reads each issue, classifies it (bug, feature, question, docs), and applies the right label. Critical bugs (keywords: crash, critical, data loss) trigger an immediate notification.

This is worth setting up even for small repos. Consistent labeling makes your backlog searchable and makes it clear what type of work is coming in.

HEARTBEAT.md
Every hour during business hours:
1. Check for new unlabeled issues: gh issue list --label "" --state open
2. Read the issue body and classify:
   - bug: reproduction steps present, error described
   - feature: "it would be nice if", "can you add"
   - question: "how do I", "is it possible"
   - docs: documentation gaps or errors
3. Add appropriate labels
4. If bug with "critical" or "crash" keywords, notify immediately
5. Daily summary: new issues by label, unassigned count

The gh CLI commands the agent uses internally:

# Find unlabeled open issues
gh issue list --label "" --state open --json number,title,body,createdAt

# Add a label to an issue
gh issue edit 42 --add-label "bug"

# Add multiple labels
gh issue edit 42 --add-label "bug,high-priority"

# View issue details
gh issue view 42 --json title,body,comments

Changelog Generator

The Changelog Generator is a SOUL.md template, not a scheduled workflow. You invoke it manually when you are ready to cut a release. Say generate changelog for v1.2.0 and the agent fetches all merged PRs since the last release, categorizes them by label, and outputs clean Markdown.

SOUL.md
You generate changelogs from git history. When I say "generate changelog for v{version}":
1. Fetch merged PRs since the last release tag:
   gh pr list --state merged --search "merged:>{last_release_date}" --json title,body,author,labels
2. Categorize by PR labels:
   - "feat" or "feature": New Features
   - "fix" or "bug": Bug Fixes
   - "docs": Documentation
   - "perf": Performance
   - "chore" or "deps": Maintenance
3. Write a changelog entry:
   - Version number and date
   - Breaking changes first (if any)
   - Each category with bullet points
   - Author credits (optional, ask first)
4. Format as Markdown, ready to paste into CHANGELOG.md
5. Ask: "Want me to create a GitHub release with this?"

Sample output:

## v1.2.0 — March 11, 2025

### New Features
- Add CSV export for user data (#142)
- Support dark mode in the dashboard (#138)

### Bug Fixes
- Fix infinite scroll breaking on filtered views (#140)
- Correct timezone handling in date pickers (#136)

### Maintenance
- Upgrade React to 18.3 (#141)
- Update Dependabot alerts (#137)

CI Failure Alerts

The CI Monitor checks GitHub Actions every 30 minutes. When a workflow fails, it fetches the failure logs, identifies the error, and sends a Telegram notification with the workflow name, branch, error summary, and a direct link to the run.

It also tracks recovery: when a previously failing workflow passes again, it sends a "fixed" notification. This closes the feedback loop without you having to check.

# Commands used by the CI Monitor
gh run list --limit 10 --json status,name,conclusion,headBranch,databaseId

# Get failure logs
gh run view {run-id} --log-failed

# List recent runs for a specific workflow
gh run list --workflow="ci.yml" --limit 5
View CI Monitor template →

Working with multiple repos

Most of these templates work with a single repo by default. For multiple repos, add a repo list to your HEARTBEAT.md and have the agent loop through them.

# HEARTBEAT.md — multi-repo config
Repos to watch:
- owner/repo-one
- owner/repo-two
- owner/repo-three

Every hour:
1. For each repo in the list:
   a. Run gh issue list --label "" --repo {repo} --state open
   b. Process new issues the same way for each
2. Batch the results into one summary

The --repo flag works for all gh commands. You can scope any query to a specific repo without having to cd into it first.

Routing notifications

By default, these workflows send notifications to your Telegram (or any connected channel). You can route different types of alerts to different places.

# HEARTBEAT.md — notification routing
Notification rules:
- Critical bugs: send to Telegram immediately
- PR reviews: post a GitHub comment + send Telegram summary
- CI failures on main branch: send to Telegram immediately
- CI failures on feature branches: batch into hourly digest
- Issue triage summaries: send to Telegram at 5pm only

The agent uses the message skill to send notifications. You can specify channel IDs or usernames for routing to different Telegram channels, Discord servers, or other connected destinations.

Get the Dev Team Stack

The Dev Team Stack bundles the PR Reviewer, Changelog Generator, Release Notes Writer, and API Health Checker into a single pack. Copy all four templates at once with one click.

See the Dev Team Stack →

Templates covered in this guide

In this guide

Setupgh CLI + github skill
PR ReviewAuto-review + comment
Issue TriageLabel + route
ChangelogFrom merged PRs
CI AlertsFailure + recovery
Multi-repoLoop pattern

Estimate your cost

PR review on Sonnet runs ~$0.50/day on an active repo.

Calculate with Clawback →

Related guides