Built-in Module
github
Interact with the GitHub API — post PR comments, inline code review comments, manage pull requests.
Operations
| Operation | Description |
|---|---|
| get_diff | Get the diff for a pull request via GitHub API |
| post_comment | Post a general comment on a pull request |
| post_inline_comments | Post inline line comments on a pull request |
Config Options
| Field | Type | Required | Description |
|---|---|---|---|
| operation | string | Yes | Operation to perform: get_diff, post_comment, or post_inline_comments |
| body | string | No | Comment body (for post_comment and post_inline_comments with text format) |
| comments | array | No | Array of comment objects (for post_inline_comments with JSON format) |
| output_format | string | No | Output format for post_inline_comments: json or text (default: text) |
| dedup | boolean | No | Enable deduplication for post_inline_comments (default: true) |
| commit_id | string | No | Commit SHA for review comments (defaults to GITHUB_SHA) |
Output Fields
| Field | Type | Description |
|---|---|---|
| success | boolean | Whether the operation succeeded |
| diff | string | PR diff content (for get_diff) |
| message | string | Status message |
| posted_count | integer | Number of comments posted (for post_inline_comments) |
| skipped_count | integer | Number of comments skipped due to deduplication (for post_inline_comments) |
| comments | array | Array 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
| Variable | Description |
|---|---|
| GITHUB_TOKEN | GitHub authentication token (required for API calls) |
| GITHUB_REPOSITORY | Repository name in format owner/repo (auto-set in GitHub Actions) |
| GITHUB_REPOSITORY_OWNER | Repository owner (auto-set in GitHub Actions) |
| GITHUB_PR_NUMBER | Pull request number (auto-set in GitHub Actions for PR events) |
| GITHUB_SHA | Commit SHA (auto-set in GitHub Actions) |
Authentication
Use GITHUB_TOKEN which is automatically available in GitHub Actions:
yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}