GitHub SCM Plugin
The GitHub SCM plugin provides comprehensive GitHub integration for pull request management, CI/CD monitoring, code review tracking, and merge readiness checks.Overview
This plugin uses the GitHub CLI (gh) to interact with the GitHub API. It monitors PR state, CI checks, code reviews, and determines when PRs are ready to merge. The orchestrator uses this information to automatically handle routine tasks and notify humans only when their judgment is needed.
The SCM plugin is designed for push-based workflows: agents create PRs, the orchestrator monitors CI/reviews, and auto-merges when ready.
Configuration
Configure the GitHub SCM plugin in youragent-orchestrator.yaml:
Configuration Options
The GitHub SCM plugin requires no additional configuration parameters. All settings are derived from the project’srepo field.
GitHub repository in
owner/repo format (e.g., octocat/hello-world).Requirements
Installing GitHub CLI
Verifying Authentication
Features
PR Detection and State
Detect PR Find a PR for a specific branch:PR Lifecycle
Merge PR Merge a PR with configurable merge method:CI/CD Monitoring
Get CI Checks Fetch all CI checks for a PR:CI Summary Logic:
passing: All checks passed (at least one check exists)failing: At least one check failedpending: No failures, but at least one check is pending/runningnone: No checks configured or PR is merged/closed
CI Check Status Mapping
GitHub Check State → CI Status:| GitHub State | CI Status |
|---|---|
SUCCESS | passed |
PENDING, QUEUED | pending |
IN_PROGRESS | running |
FAILURE, TIMED_OUT, CANCELLED | failed |
SKIPPED, NEUTRAL | skipped |
| Unknown | failed (fail-closed) |
Code Review Tracking
Get Reviews Fetch all reviews for a PR:Review Comments
Get Pending Comments Fetch unresolved review comments (excludes bot comments):Pending comments only include unresolved threads from human reviewers. Bot comments are filtered out.
Known Bot Authors
The plugin filters these bot accounts:cursor[bot]github-actions[bot]codecov[bot]sonarcloud[bot]dependabot[bot]renovate[bot]codeclimate[bot]deepsource-autofix[bot]snyk-botlgtm-com[bot]
Merge Readiness
Get Mergeability Comprehensive merge readiness check:mergeable: false, the blockers array contains reasons:
Usage Example
Auto-Merge Workflow
- All CI checks pass
- Reviews are approved
- No merge conflicts exist
Monitor PR Progress
Handle CI Failures
Troubleshooting
Error: gh command not found
Error: gh command not found
The GitHub CLI is not installed or not in PATH.Solution:
Error: Failed to fetch CI checks
Error: Failed to fetch CI checks
The plugin couldn’t retrieve CI check status.Common causes:
- No CI checks configured for the repository
- GitHub API timeout
- Network connectivity issues
- PR is closed/merged (no check data)
CI status shows 'none' but checks exist
CI status shows 'none' but checks exist
This happens when all checks are skipped or neutral.The plugin only reports
passing if at least one check actually passed (not all skipped).Review decision is 'none' but reviews exist
Review decision is 'none' but reviews exist
GitHub’s
reviewDecision field aggregates reviews. It’s none when:- No review is required by branch protection
- All reviews are comments (not approvals or change requests)
- Reviews were dismissed
Pending comments include bot comments
Pending comments include bot comments
The plugin filters bot comments using a predefined list of known bot authors.If a new bot is not filtered, add it to
BOT_AUTHORS in the source code:Merge fails with 'blocked by branch protection'
Merge fails with 'blocked by branch protection'
GitHub branch protection rules are preventing the merge.Common protections:
- Required reviews not met
- Required status checks not passed
- Branch not up to date with base
- Signed commits required
PR state is 'unknown' in mergeability check
PR state is 'unknown' in mergeability check
GitHub is still computing merge state (happens for large PRs or complex conflicts).The plugin reports this as a blocker: “Merge status unknown (GitHub is computing)”Wait a few seconds and check again.
API Reference
SCM Interface Methods
detectPR(session, project)- Finds PR by branch name
- Returns:
PRInfo | null
- Returns:
"open" | "closed" | "merged"
- Returns:
{ state, title, additions, deletions }
- Merges PR with specified method
- Deletes branch automatically
- Returns:
void
- Closes PR without merging
- Returns:
void
- Returns:
CICheck[]
- Returns:
"passing" | "failing" | "pending" | "none"
- Returns:
Review[]
- Returns:
"approved" | "changes_requested" | "pending" | "none"
- Returns:
ReviewComment[](human reviewers only)
- Returns:
AutomatedComment[](bots only)
- Returns:
MergeReadiness
Advanced Usage
Merge Methods
CI Monitoring Loop
Review Comment Handling
Comprehensive Merge Check
Integration with Other Plugins
With Tracker Plugin
The SCM and tracker plugins work together:- Tracker creates issue and generates prompt
- Agent writes code and creates PR
- SCM monitors CI and reviews
- Tracker updates issue when PR merges
With Notifier Plugin
Send notifications based on PR events:Performance Considerations
API Calls
The plugin makes multiple API calls per operation:getMergeability: 3-4 calls (PR state, CI, reviews, merge status)getCIChecks: 1 callgetReviews: 1 callgetPendingComments: 1 call (GraphQL)
Rate Limits
GitHub API rate limits (authenticated):- REST API: 5,000 requests/hour
- GraphQL API: 5,000 points/hour
gh CLI handles authentication and rate limiting automatically.
Caching
The plugin does not cache responses. The orchestrator should implement caching if polling frequently.Security Considerations
Source Code
Source:packages/plugins/scm-github/src/index.ts