|
1 | 1 | name: PR Review |
2 | 2 | on: |
3 | | - issue_comment: # Enables /review command in PR comments |
| 3 | + issue_comment: |
4 | 4 | types: [created] |
5 | | - pull_request_review_comment: # Captures feedback on review comments for learning |
6 | | - 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] |
| 5 | + workflow_run: |
| 6 | + workflows: ["PR Review - Trigger"] |
| 7 | + types: [completed] |
9 | 8 |
|
10 | 9 | permissions: |
11 | 10 | contents: read # Required at top-level to give `issue_comment` events access to the secrets below. |
12 | 11 |
|
13 | 12 | jobs: |
14 | 13 | review: |
15 | | - uses: docker/cagent-action/.github/workflows/review-pr.yml@d98096f432f2aea5091c811852c4da804e60623a # v1.4.1 |
| 14 | + if: | |
| 15 | + github.event_name == 'issue_comment' || |
| 16 | + github.event.workflow_run.conclusion == 'success' |
| 17 | + uses: docker/cagent-action/.github/workflows/review-pr.yml@ec4865576952df6285652f2cf8ffb4ad45ff5f80 # v1.4.3 |
16 | 18 | # Scoped to the job so other jobs in this workflow aren't over-permissioned |
17 | 19 | permissions: |
18 | 20 | contents: read # Read repository files and PR diffs |
19 | | - pull-requests: write # Post review comments and approve/request changes |
20 | | - issues: write # Create security incident issues if secrets are detected in output |
21 | | - checks: write # (Optional) Show review progress as a check run on the PR |
| 21 | + pull-requests: write # Post review comments |
| 22 | + issues: write # Create security incident issues if secrets detected |
| 23 | + checks: write # (Optional) Show review progress as a check run |
22 | 24 | id-token: write # Required for OIDC authentication to AWS Secrets Manager |
23 | | - secrets: |
24 | | - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} |
25 | | - CAGENT_ORG_MEMBERSHIP_TOKEN: ${{ secrets.CAGENT_ORG_MEMBERSHIP_TOKEN }} # PAT with read:org scope; gates auto-reviews to org members only |
26 | | - CAGENT_REVIEWER_APP_ID: ${{ secrets.CAGENT_REVIEWER_APP_ID }} # GitHub App ID; reviews appear as your app instead of github-actions[bot] |
27 | | - CAGENT_REVIEWER_APP_PRIVATE_KEY: ${{ secrets.CAGENT_REVIEWER_APP_PRIVATE_KEY }} # GitHub App private key; paired with App ID above |
| 25 | + actions: read # Download artifacts from trigger workflow |
| 26 | + with: |
| 27 | + trigger-run-id: ${{ github.event_name == 'workflow_run' && format('{0}', github.event.workflow_run.id) || '' }} |
| 28 | + |
0 commit comments