← MarketplaceGet started free
Guide

GitHub PR Automation with AI: A Complete Guide

What You Can Automate

GitHub PRs involve a lot of repetitive text work — writing descriptions, reviewing code, tagging issues, labelling PRs. AI agents can handle all of these programmatically via the Runcept API.

TaskAgentWhen it runs

|------|-------|-------------|

PR descriptionpr-descriptionOn PR open/update Code reviewcode-reviewerOn push to PR branch Commit messagecommit-messagesPre-commit hook README updatereadme-generatorOn merge to main

Prerequisites

  • Runcept account and API key (set as RUNCEPT_API_KEY repo secret)
  • GitHub Actions enabled on your repo
  • The Combined Workflow

    ``.github/workflows/ai-pr-automation.yml

    yaml

    name: AI PR Automation

    on:

    pull_request:

    types: [opened, synchronize]

    jobs:

    ai-automation:

    runs-on: ubuntu-latest

    permissions:

    pull-requests: write

    steps:

    - uses: actions/checkout@v4

    with:

    fetch-depth: 0

    - name: Get diff

    id: diff

    run: |

    DIFF=$(git diff origin/${{ github.base_ref }}...HEAD | head -c 8000)

    echo "content<> $GITHUB_OUTPUT

    echo "$DIFF" >> $GITHUB_OUTPUT

    echo "DIFF_EOF" >> $GITHUB_OUTPUT

    - name: Run PR description agent

    id: pr_desc

    env:

    RUNCEPT_API_KEY: ${{ secrets.RUNCEPT_API_KEY }}

    run: |

    RESPONSE=$(curl -sS -X POST https://www.runcept.com/api/v1/run \

    -H "Authorization: Bearer $RUNCEPT_API_KEY" \

    -H "Content-Type: application/json" \

    --data-raw "{\"agent\": \"pr-description\", \"input\": {\"diff\": $(echo '${{ steps.diff.outputs.content }}' | jq -Rs .)}}")

    JOB_ID=$(echo $RESPONSE | jq -r '.job_id')

    for i in {1..20}; do

    sleep 4

    RESULT=$(curl -sS "https://www.runcept.com/api/v1/jobs/$JOB_ID" \

    -H "Authorization: Bearer $RUNCEPT_API_KEY")

    if [ "$(echo $RESULT | jq -r '.status')" = "complete" ]; then

    echo "description=$(echo $RESULT | jq -r '.output.description')" >> $GITHUB_OUTPUT

    break

    fi

    done

    - name: Post PR description

    uses: actions/github-script@v7

    with:

    script: |

    const desc = ${{ steps.pr_desc.outputs.description }}

    // Update PR body

    await github.rest.pulls.update({

    owner: context.repo.owner,

    repo: context.repo.repo,

    pull_number: context.issue.number,

    body: desc,

    })

    
    

    Adding Code Review

    Add a second job that runs in parallel:

    yaml

    code-review:

    runs-on: ubuntu-latest

    needs: [] # run in parallel

    steps:

    - uses: actions/checkout@v4

    with:

    fetch-depth: 0

    - name: AI code review

    env:

    RUNCEPT_API_KEY: ${{ secrets.RUNCEPT_API_KEY }}

    run: |

    # same pattern — agent: code-reviewer

    # exit 1 if score < 70

    ``

    Next Steps

  • PR description guide
  • Code review guide
  • Commit message hook
  • Browse all code agents
  • Related guides

    Call an AI Agent API from Node.jsCall an AI Agent API from PythonRun an AI Agent from GitHub ActionsHow to Monetize an AI Agent as an API