Built-in Module

github

Interact with the GitHub API — post PR comments, inline code review comments, manage pull requests.

Operations

OperationDescription
get_diffGet the diff for a pull request via GitHub API
post_commentPost a general comment on a pull request
post_inline_commentsPost inline line comments on a pull request

Config Options

FieldTypeRequiredDescription
operationstringYesOperation to perform: get_diff, post_comment, or post_inline_comments
bodystringNoComment body (for post_comment and post_inline_comments with text format)
commentsarrayNoArray of comment objects (for post_inline_comments with JSON format)
output_formatstringNoOutput format for post_inline_comments: json or text (default: text)
dedupbooleanNoEnable deduplication for post_inline_comments (default: true)
commit_idstringNoCommit SHA for review comments (defaults to GITHUB_SHA)

Output Fields

FieldTypeDescription
successbooleanWhether the operation succeeded
diffstringPR diff content (for get_diff)
messagestringStatus message
posted_countintegerNumber of comments posted (for post_inline_comments)
skipped_countintegerNumber of comments skipped due to deduplication (for post_inline_comments)
commentsarrayArray of posted comments (for post_inline_comments)

Examples

Get PR Diff

json
{
  "id": "get-diff",
  "type": "github",
  "config": {
    "operation": "get_diff"
  }
}

Output is available as {{steps.get-diff.diff}} for use in subsequent AI steps.

Post General PR Comment

json
{
  "id": "post_review",
  "type": "github",
  "depends_on": ["ai_review"],
  "config": {
    "operation": "post_comment",
    "body": "{{steps.ai_review.content}}"
  }
}

Post Inline Comments (Text Format)

json
{
  "id": "post_inline_comments",
  "type": "github",
  "depends_on": ["ai_review"],
  "config": {
    "operation": "post_inline_comments",
    "body": "{{steps.ai_review.content}}",
    "output_format": "text",
    "dedup": true
  }
}

AI prompt for text format: Review this code diff and provide comments in format: 'path/to/file.go:42 - issue description'

Post Inline Comments (JSON Format)

json
{
  "id": "post_inline_comments",
  "type": "github",
  "depends_on": ["ai_review"],
  "config": {
    "operation": "post_inline_comments",
    "comments": "{{steps.ai_review.comments}}",
    "output_format": "json",
    "dedup": true
  }
}

AI prompt for JSON format: Return JSON array with file, line, and comment fields

Environment Variables

VariableDescription
GITHUB_TOKENGitHub authentication token (required for API calls)
GITHUB_REPOSITORYRepository name in format owner/repo (auto-set in GitHub Actions)
GITHUB_REPOSITORY_OWNERRepository owner (auto-set in GitHub Actions)
GITHUB_PR_NUMBERPull request number (auto-set in GitHub Actions for PR events)
GITHUB_SHACommit SHA (auto-set in GitHub Actions)

Authentication

Use GITHUB_TOKEN which is automatically available in GitHub Actions:

yaml
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}