Repository navigation
Expand file tree
/
Copy pathai-code-review.yml
More file actions
60 lines (58 loc) · 3.14 KB
/
Copy pathai-code-review.yml
File metadata and controls
60 lines (58 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copy to .github/workflows/ai-code-review.yml in your repo.
# NOTE: Do NOT declare a top-level `concurrency:` block in this caller workflow.
# The reusable workflow manages per-PR concurrency internally on its job
# (`group: ai-review-<PR>`). A top-level `concurrency:` block with a PR-scoped
# group name deadlocks GitHub Actions against the nested `select-and-review` job
# and cancels the run ([gha#437](https://github.com/Morrison-Lab/gha/issues/437)).
#
# Dispatches a review from one of the configured AI agents, chosen at random,
# falling through to the next candidate when one can't be dispatched or fails
# during execution ([gha#362](https://github.com/Morrison-Lab/gha/issues/362), [gha#444](https://github.com/Morrison-Lab/gha/issues/444)).
# NOTE: requires each agent's own review workflow to exist in your repo --- copy
# examples/claude-code-review.yml, examples/gemini-code-review.yml,
# examples/antigravity-code-review.yml, examples/cursor-code-review.yml, and/or
# examples/opencode-code-review.yml too,
# and set the *-review-workflow-file inputs below if you rename them.
# Pass secrets explicitly (below) rather than via `secrets: inherit`: GitHub
# only inherits secrets into a reusable workflow owned by the same org/user, so
# a cross-owner caller inherits an empty token and the run fails.
name: AI Code Review
on:
# Optional: automatic review on PR activity.
# Note: GitHub suppresses pull_request workflow runs when a pull request
# has merge conflicts with the target branch. For conflicting PRs, resolve
# the conflict or trigger review via workflow_dispatch below (gha#859).
# pull_request:
# types: [opened, synchronize, ready_for_review, reopened]
workflow_dispatch:
inputs:
pr_number:
description: 'Pull request number to review'
required: true
type: string
jobs:
ai-review:
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && !github.event.pull_request.draft)
permissions:
contents: read
pull-requests: read
issues: read
actions: write
uses: Morrison-Lab/gha/.github/workflows/ai-code-review.yml@v2
secrets:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} # Max-plan OAuth; empty when using API key
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} # direct API key; empty when using OAuth
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }} # Enterprise Bugbot API; empty when unused
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} # OpenCode Zen key; empty when unused
with:
pr-number: ${{ inputs.pr_number }}
# agents: 'claude, gemini, antigravity, cursor, opencode' # pool to choose from
# claude-review-workflow-file: claude-code-review.yml
# gemini-review-workflow-file: gemini-code-review.yml
# antigravity-review-workflow-file: antigravity-code-review.yml
# cursor-review-workflow-file: cursor-code-review.yml
# opencode-review-workflow-file: opencode-code-review.yml
# watch-timeout: 30m # timeout per candidate agent watch