Set up PR Agent

You provide credentials, the validation command, and the GitHub merge rules. PR Agent only pushes after it returns PASS and the validation command succeeds.

1. Add repository secrets

In Settings → Secrets and variables → Actions, add:

Use a PAT or GitHub App token because GitHub’s built-in GITHUB_TOKEN does not normally trigger other CI workflows after pushing a repair. GitHub explains this behavior.

2. Add the caller workflow

Create .github/workflows/pr-agent.yml in your repository. Replace npm test with the real project test command.

name: PR Agent

on:
  pull_request:
    types: [opened, synchronize, reopened]

permissions:
  contents: write
  pull-requests: write

jobs:
  agent:
    uses: zc6600/agentic-swe/.github/workflows/pr-agent.yml@main
    with:
      validation-command: npm test
    secrets:
      OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
      PR_AGENT_TOKEN: ${{ secrets.PR_AGENT_TOKEN }}

For production, pin the reusable workflow to a reviewed release tag or commit SHA instead of @main.

3. Enable merge rules

Turn on Allow auto-merge in repository settings and configure the branch-protection checks required before merging. PR Agent does not bypass these rules.