Skip to main content

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 your agent-orchestrator.yaml:

Configuration Options

The GitHub SCM plugin requires no additional configuration parameters. All settings are derived from the project’s repo field.
string
required
GitHub repository in owner/repo format (e.g., octocat/hello-world).

Requirements

Prerequisites:
  • GitHub CLI (gh) installed and in PATH
  • Authenticated with gh auth login
  • Read/write access to pull requests in the target repository
  • Repository must have Actions or Checks configured for CI

Installing GitHub CLI

Verifying Authentication

Features

PR Detection and State

Detect PR Find a PR for a specific branch:
Get PR State Check if a PR is open, closed, or merged:
Get PR Summary Get high-level PR information:

PR Lifecycle

Merge PR Merge a PR with configurable merge method:
Close PR Close a PR without merging:

CI/CD Monitoring

Get CI Checks Fetch all CI checks for a PR:
Get CI Summary Get high-level CI status:
CI Summary Logic:
  • passing: All checks passed (at least one check exists)
  • failing: At least one check failed
  • pending: No failures, but at least one check is pending/running
  • none: No checks configured or PR is merged/closed

CI Check Status Mapping

GitHub Check State → CI Status:

Code Review Tracking

Get Reviews Fetch all reviews for a PR:
Get Review Decision Get the overall review decision (GitHub’s aggregate status):

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.
Get Automated Comments Fetch comments from bots (CI tools, linters, security scanners):

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-bot
  • lgtm-com[bot]

Merge Readiness

Get Mergeability Comprehensive merge readiness check:
Blocker Examples When mergeable: false, the blockers array contains reasons:
The plugin uses a fail-closed approach: if it can’t determine CI status or review state, it reports the PR as not ready to merge.

Usage Example

Auto-Merge Workflow

This configuration automatically merges PRs when:
  1. All CI checks pass
  2. Reviews are approved
  3. No merge conflicts exist

Monitor PR Progress

Handle CI Failures

Troubleshooting

The GitHub CLI is not installed or not in PATH.Solution:
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)
The plugin fails closed: reports CI as “failing” to prevent auto-merge.
This happens when all checks are skipped or neutral.The plugin only reports passing if at least one check actually passed (not all skipped).
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
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:
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
Check repository settings → Branches → Branch protection rules.
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
getPRState(pr)
  • Returns: "open" | "closed" | "merged"
getPRSummary(pr)
  • Returns: { state, title, additions, deletions }
mergePR(pr, method)
  • Merges PR with specified method
  • Deletes branch automatically
  • Returns: void
closePR(pr)
  • Closes PR without merging
  • Returns: void
getCIChecks(pr)
  • Returns: CICheck[]
getCISummary(pr)
  • Returns: "passing" | "failing" | "pending" | "none"
getReviews(pr)
  • Returns: Review[]
getReviewDecision(pr)
  • Returns: "approved" | "changes_requested" | "pending" | "none"
getPendingComments(pr)
  • Returns: ReviewComment[] (human reviewers only)
getAutomatedComments(pr)
  • Returns: AutomatedComment[] (bots only)
getMergeability(pr)
  • 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:
  1. Tracker creates issue and generates prompt
  2. Agent writes code and creates PR
  3. SCM monitors CI and reviews
  4. 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 call
  • getReviews: 1 call
  • getPendingComments: 1 call (GraphQL)

Rate Limits

GitHub API rate limits (authenticated):
  • REST API: 5,000 requests/hour
  • GraphQL API: 5,000 points/hour
The 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

  • All GitHub API calls are made through the gh CLI (no direct token handling)
  • Commands are executed with execFile (not exec) to prevent shell injection
  • 30-second timeout prevents hanging on network issues
  • Repository format is validated before use
  • Fail-closed approach: unknown states are treated as blocking

Source Code

Source: packages/plugins/scm-github/src/index.ts