Skip to content

Commit a9ee40d

Browse files
committed
Add AI-powered PR review workflow via docker/cagent-action
Introduce a GitHub Actions workflow that triggers an AI-powered code review on pull requests using docker/cagent-action's reusable workflow. - Restrict comment-triggered runs to OWNER/MEMBER/COLLABORATOR - Gate on github.repository to prevent execution on forks - Filter out draft PRs and bot actors - Only trigger on PR comments, not plain issue comments - Serialize reviews per PR via concurrency group Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
1 parent 5de4353 commit a9ee40d

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

.github/workflows/pr-review.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: PR Review
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, ready_for_review]
6+
issue_comment:
7+
types: [created]
8+
pull_request_review_comment:
9+
types: [created]
10+
11+
# Serialize reviews per PR; do not cancel in-progress runs
12+
# so no review is silently dropped mid-execution.
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number }}
15+
cancel-in-progress: false
16+
17+
jobs:
18+
review:
19+
# Only run on the upstream repo (not forks) to prevent credential leaks.
20+
# Skip draft PRs (ready_for_review will fire when promoted).
21+
# Skip bot actors to avoid reviewing Dependabot and automation PRs.
22+
# Require collaborator-level access for comment-triggered events.
23+
# Only trigger on PR comments, not plain issue comments.
24+
if: >-
25+
github.repository == 'docker/compose' &&
26+
(github.event_name != 'pull_request_target' || github.event.pull_request.draft == false) &&
27+
(github.event_name == 'pull_request_target' ||
28+
(github.event.issue.pull_request &&
29+
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association))) &&
30+
!endsWith(github.actor, '[bot]')
31+
uses: docker/cagent-action/.github/workflows/review-pr.yml@3a12dbd0c6cd7dda3d4e05f24f0143c9701456de # v1.2.13
32+
secrets:
33+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
34+
CAGENT_ORG_MEMBERSHIP_TOKEN: ${{ secrets.CAGENT_ORG_MEMBERSHIP_TOKEN }}
35+
CAGENT_REVIEWER_APP_ID: ${{ secrets.CAGENT_REVIEWER_APP_ID }}
36+
CAGENT_REVIEWER_APP_PRIVATE_KEY: ${{ secrets.CAGENT_REVIEWER_APP_PRIVATE_KEY }}
37+
permissions:
38+
contents: read # to fetch code
39+
pull-requests: write # to post review comments
40+
issues: write # to reply to issue/PR comments
41+
checks: write # to update check statuses

0 commit comments

Comments
 (0)