name: PR Agent
on:
pull_request:
types:
- opened
- synchronize
issue_comment:
types:
- created
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
issues: write
pull-requests: write
statuses: write
jobs:
pr-agent:
name: PR-Agent review assistant
runs-on: ubuntu-latest
timeout-minutes: 10
if: >
github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' ||
(
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) &&
startsWith(github.event.comment.body, '/')
)
steps:
- uses: the-pr-agent/pr-agent@8e4d32e5497defd43c023a404f73560c62728961
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_KEY: ${{ secrets.PR_AGENT_OPENAI_KEY }}
OPENAI.API_BASE: ${{ secrets.PR_AGENT_OPENAI_API_BASE }}
PR_AGENT_CONFIG_BRANCH: ${{ github.head_ref || github.ref_name }}
with:
config.model: ${{ vars.PR_AGENT_MODEL || 'gpt-4o' }}
config.response_language: "zh-CN"
github_action_config.auto_review: "true"
github_action_config.auto_describe: "false"
github_action_config.auto_improve: "false"
pr_description.add_original_user_description: "false"
github_action_config.pr_actions: '["opened", "synchronize"]'