Skip to main content

Overview

Forge integrates with GitHub for authentication, pull request creation, and repository operations. Base URL: http://localhost:8887/api/github

Authentication

GitHub OAuth Device Flow

Forge uses GitHub’s device flow for authentication.

Step 1: Initiate Device Flow

Response:

Step 2: Poll for Token

Request:
Response (pending):
Response (success):

Pull Requests

Create Pull Request

Create a GitHub PR from task attempt branch (covered in Attempts API).
string
required
The task attempt ID
See Attempts API - Create GitHub PR for details.

Attach Existing PR

Link an existing GitHub PR to a task attempt.
string
required
The task attempt ID
See Attempts API - Attach Existing PR for details.

Repository Operations

Get Repository Info

Get information about the project’s GitHub repository.
string
required
The project ID

List Pull Requests

List pull requests for a project.
string
required
The project ID
string
default:"open"
Filter by PR state: open, closed, or all
integer
default:"1"
Page number for pagination
integer
default:"20"
Items per page (max 100)

Webhooks

Configure Webhook

Set up GitHub webhook to receive events.
string
required
The project ID
array
required
Array of events to subscribe to: pull_request, push, issue_comment, pull_request_review
string
required
The webhook endpoint URL to receive GitHub events
Supported Events:
  • pull_request - PR opened, closed, merged
  • push - Commits pushed
  • issue_comment - Comments on issues/PRs
  • pull_request_review - PR reviews

SDK Examples


Next Steps

Attempts API

Create PRs from task attempts

Authentication

Configure GitHub OAuth