Skip to content

Commit d4e09ab

Browse files
committed
chore: update cagent-action to v1.4.1
Signed-off-by: Derek Misler <[email protected]>
1 parent baaaaa3 commit d4e09ab

2 files changed

Lines changed: 61 additions & 21 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: PR Review - Trigger
2+
on:
3+
pull_request:
4+
types: [ready_for_review, opened]
5+
permissions: {}
6+
jobs:
7+
save-pr:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Save PR number
11+
env:
12+
PR_NUMBER: ${{ github.event.pull_request.number }}
13+
run: printf '%s' "$PR_NUMBER" > pr_number.txt
14+
15+
- name: Upload PR context
16+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
17+
with:
18+
name: pr-review-context
19+
path: pr_number.txt
20+
retention-days: 1

.github/workflows/pr-review.yml

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,50 @@
11
name: PR Review
22
on:
3-
issue_comment: # Enables /review command in PR comments
3+
issue_comment:
44
types: [created]
5-
pull_request_review_comment: # Captures feedback on review comments for learning
5+
pull_request_review_comment:
66
types: [created]
7-
pull_request: # Triggers auto-review on PR open (same-repo branches only; fork PRs use /review)
8-
types: [ready_for_review, opened]
7+
workflow_run:
8+
workflows: ["PR Review - Trigger"]
9+
types: [completed]
910

1011
permissions:
11-
contents: read # Required at top level so `GITHUB_TOKEN` for `issue_comment` events can read repository contents.
12+
contents: read
1213

1314
jobs:
14-
review:
15-
if: >-
16-
github.event_name == 'issue_comment' ||
17-
github.event_name == 'pull_request_review_comment' ||
18-
github.event.pull_request.user.login != 'dependabot[bot]'
19-
uses: docker/cagent-action/.github/workflows/review-pr.yml@dba0ca51938c78afb363625363c50582243218d6 # v1.3.1
20-
# Scoped to the job so other jobs in this workflow aren't over-permissioned
15+
get-pr-context:
16+
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
17+
runs-on: ubuntu-latest
18+
outputs:
19+
pr-number: ${{ steps.pr.outputs.number }}
20+
steps:
21+
- name: Download PR context
22+
if: github.event_name == 'workflow_run'
23+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
24+
with:
25+
name: pr-review-context
26+
run-id: ${{ github.event.workflow_run.id }}
27+
github-token: ${{ github.token }}
28+
29+
- name: Read PR number
30+
id: pr
31+
if: github.event_name == 'workflow_run'
32+
run: echo "number=$(cat pr_number.txt)" >> $GITHUB_OUTPUT
33+
34+
run-docker-agent:
35+
needs: [get-pr-context]
36+
if: |
37+
always() && (
38+
github.event_name == 'issue_comment' ||
39+
github.event_name == 'pull_request_review_comment' ||
40+
needs.get-pr-context.result == 'success'
41+
)
42+
uses: docker/cagent-action/.github/workflows/review-pr.yml@d98096f432f2aea5091c811852c4da804e60623a # v1.4.1
2143
permissions:
22-
contents: read # Read repository files and PR diffs
23-
pull-requests: write # Post review comments and approve/request changes
24-
issues: write # Create security incident issues if secrets are detected in output
25-
checks: write # (Optional) Show review progress as a check run on the PR
26-
secrets:
27-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
28-
CAGENT_ORG_MEMBERSHIP_TOKEN: ${{ secrets.CAGENT_ORG_MEMBERSHIP_TOKEN }} # PAT with read:org scope; gates auto-reviews to org members only
29-
CAGENT_REVIEWER_APP_ID: ${{ secrets.CAGENT_REVIEWER_APP_ID }} # GitHub App ID; reviews appear as your app instead of github-actions[bot]
30-
CAGENT_REVIEWER_APP_PRIVATE_KEY: ${{ secrets.CAGENT_REVIEWER_APP_PRIVATE_KEY }} # GitHub App private key; paired with App ID above
44+
contents: read
45+
pull-requests: write
46+
issues: write
47+
checks: write
48+
id-token: write
49+
with:
50+
pr-number: ${{ needs.get-pr-context.outputs.pr-number }}

0 commit comments

Comments
 (0)