Intermediate6 min read

Run Forge in GitHub Actions

Automate an AI review on every pull request and gate merges on the agent verdict.

The Forge AI Run action lets you run an agent team on every pull request. It posts the result as a comment and can fail the check as a quality gate — perfect for automated DevSecOps reviews, code review, and compliance checks.

Step 1: Add your API key as a secret

In your repo, go to Settings → Secrets and variables → Actions and add a secret named FORGE_API_KEY with your Forge key.

Step 2: Add the workflow

Create .github/workflows/forge-review.yml:

name: Forge PR Review
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  review:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write   # to post the result comment
      contents: read
    steps:
      - uses: ShanovaAI/Forge/packages/github-action@main
        with:
          api-key: ${{ secrets.FORGE_API_KEY }}
          team-id: <your-team-id>
          brief: |
            Review PR #${{ github.event.pull_request.number }}:
            ${{ github.event.pull_request.title }}
            ${{ github.event.pull_request.body }}
          fail-on: blocked,needs_revision

Step 3: Open a pull request

The action creates a run, streams agent events into the job log, and posts a sticky comment with the status, outputs, and a link. On the next commit it updates the same comment instead of adding a new one.

Step 4: Gate the merge (optional)

The fail-on input fails the check — blocking the merge if the check is required — when any of these match:

  • failed — the run failed
  • blocked — the run or an agent is blocked / needs approval
  • needs_revision — an agent returned a needs_revision verdict
  • confidence<0.7 — an agent's confidence dropped below the threshold
Tip:Set wait: false to fire-and-forget, or comment: false to skip the PR comment. The action also setsrun-id, run-url, status, and outputs for use in later steps.
Run Forge in GitHub Actions — Forge Guides — Forge