Conversation
Dispatches PR events to ethyca/talos for automated code review. Triggers on PR open, ready for review, reopen, and /code-review comments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
📝 WalkthroughWalkthroughAdds a GitHub Actions workflow that orchestrates automated code reviews by dispatching events to an external service (ethyca/talos). The workflow triggers on pull request state changes and issue comments containing "/code-review", fetches PR metadata when needed, and sends review requests with repository and commit details. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
Greptile SummaryThis PR adds a thin GitHub Actions dispatcher workflow ( Key issues found:
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: b433817 |
| permissions: | ||
| contents: read |
There was a problem hiding this comment.
Missing pull-requests: read permission
The Get PR details (comment trigger) step calls gh api repos/.../pulls/${{ github.event.issue.number }} using ${{ github.token }}, but the workflow only declares contents: read. The Pulls API endpoint requires pull-requests: read scope for the GITHUB_TOKEN in private or organization repos. Without it, the step can fail with a 403 or empty response, causing the dispatched payload to carry empty head_ref, base_ref, and head_sha values.
| permissions: | |
| contents: read | |
| permissions: | |
| contents: read | |
| pull-requests: read |
| || ( | ||
| github.event_name == 'issue_comment' | ||
| && github.event.issue.pull_request | ||
| && contains(github.event.comment.body, '/code-review') | ||
| ) |
There was a problem hiding this comment.
No permission check on /code-review comment trigger
The condition only verifies that the comment is on a pull request and contains /code-review, but does not check whether the commenter has any write/maintain/admin access to the repository. On a public repo this means any external user can trigger an unlimited number of Claude reviews (and dispatch events to ethyca/talos) simply by posting that string in a comment. The cancel-in-progress: true concurrency group partially mitigates spam, but a bad actor can still rack up dispatches on different PRs simultaneously.
Consider adding an actor permission check, e.g.:
|| (
github.event_name == 'issue_comment'
&& github.event.issue.pull_request
&& contains(github.event.comment.body, '/code-review')
&& (
github.event.comment.author_association == 'OWNER'
|| github.event.comment.author_association == 'MEMBER'
|| github.event.comment.author_association == 'COLLABORATOR'
)
)There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/claude-code-review.yml (1)
27-29: Add explicitpull-requests: readpermission for PR metadata fetch.Line 52-Line 56 call the Pull Requests API, but workflow permissions only declare
contents: read. Make PR-read permission explicit so this path remains reliable under stricter token policies.Suggested fix
permissions: contents: read + pull-requests: readAlso applies to: 52-56
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/claude-code-review.yml around lines 27 - 29, Current workflow permissions only include "contents: read" which is insufficient for calls to the Pull Requests API; update the workflow's permissions block by adding an explicit "pull-requests: read" entry alongside "contents: read" so the GitHub Actions token can fetch PR metadata reliably. Locate the permissions YAML block (the "permissions:" mapping containing "contents: read") and add "pull-requests: read" at the same level.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/claude-code-review.yml:
- Around line 40-43: The workflow currently triggers on any PR comment
containing '/code-review' and then uses secrets.TALOS_DISPATCH_TOKEN; restrict
this by adding an additional condition that the commenter is trusted (e.g.,
check github.event.comment.author_association is one of
'OWNER','MEMBER','COLLABORATOR' or compare github.actor against an allowlist
stored in a secret/ENV like TRUSTED_USERS). Update the conditional block (the
expression that includes "github.event_name == 'issue_comment' &&
github.event.issue.pull_request && contains(github.event.comment.body,
'/code-review')") to also require the trusted-check, and ensure the dispatch
step that uses secrets.TALOS_DISPATCH_TOKEN only runs when that trusted
condition passes.
- Line 59: The workflow uses a mutable tag for the third-party action (uses:
peter-evans/repository-dispatch@v3); replace that tag with the action's full
commit SHA to pin the dependency. Locate the uses line referencing
peter-evans/repository-dispatch (the string "uses:
peter-evans/repository-dispatch@v3"), find the corresponding release/commit on
the peter-evans/repository-dispatch GitHub repo, and update the workflow to use
the immutable ref format (e.g., @<full-commit-sha>) instead of `@v3`.
---
Nitpick comments:
In @.github/workflows/claude-code-review.yml:
- Around line 27-29: Current workflow permissions only include "contents: read"
which is insufficient for calls to the Pull Requests API; update the workflow's
permissions block by adding an explicit "pull-requests: read" entry alongside
"contents: read" so the GitHub Actions token can fetch PR metadata reliably.
Locate the permissions YAML block (the "permissions:" mapping containing
"contents: read") and add "pull-requests: read" at the same level.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6d8b38b0-7922-4dad-acac-54ee18784b04
📒 Files selected for processing (1)
.github/workflows/claude-code-review.yml
| github.event_name == 'issue_comment' | ||
| && github.event.issue.pull_request | ||
| && contains(github.event.comment.body, '/code-review') | ||
| ) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n .github/workflows/claude-code-review.yml | head -80Repository: ethyca/fides
Length of output: 3236
🌐 Web query:
GitHub Actions issue_comment context author_association field
💡 Result:
In a GitHub Actions workflow triggered by issue_comment, the comment author’s association is available at:
${{ github.event.comment.author_association }}(string) — taken directly from theissue_commentwebhook payload’scomment.author_associationfield. [1][2]
Common values include: OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR, FIRST_TIMER, FIRST_TIME_CONTRIBUTOR, MANNEQUIN, NONE. [3]
Example:
on:
issue_comment:
types: [created]
jobs:
gate:
if: ${{ github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' }}
runs-on: ubuntu-latest
steps:
- run: echo "Trusted commenter"Sources: [1][2][3]
Restrict /code-review trigger to trusted commenters.
Lines 40-43 allow any PR commenter to trigger a dispatch that uses secrets.TALOS_DISPATCH_TOKEN. This creates a security and cost risk on public repos—external contributors (including first-time contributors) can trigger the token usage.
Suggested fix
|| (
github.event_name == 'issue_comment'
&& github.event.issue.pull_request
&& contains(github.event.comment.body, '/code-review')
+ && contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/claude-code-review.yml around lines 40 - 43, The workflow
currently triggers on any PR comment containing '/code-review' and then uses
secrets.TALOS_DISPATCH_TOKEN; restrict this by adding an additional condition
that the commenter is trusted (e.g., check
github.event.comment.author_association is one of
'OWNER','MEMBER','COLLABORATOR' or compare github.actor against an allowlist
stored in a secret/ENV like TRUSTED_USERS). Update the conditional block (the
expression that includes "github.event_name == 'issue_comment' &&
github.event.issue.pull_request && contains(github.event.comment.body,
'/code-review')") to also require the trusted-check, and ensure the dispatch
step that uses secrets.TALOS_DISPATCH_TOKEN only runs when that trusted
condition passes.
| echo "pr_number=${{ github.event.issue.number }}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Dispatch code review to talos | ||
| uses: peter-evans/repository-dispatch@v3 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n .github/workflows/claude-code-review.yml | grep -A 2 -B 2 "repository-dispatch"Repository: ethyca/fides
Length of output: 251
🏁 Script executed:
# Check all action uses in the workflow
rg "uses:" .github/workflows/claude-code-review.ymlRepository: ethyca/fides
Length of output: 104
🏁 Script executed:
# Get the specific commit SHA for peter-evans/repository-dispatch@v3
# This requires checking GitHub - let's get the repo info
curl -s https://api.github.com/repos/peter-evans/repository-dispatch/git/refs/tags/v3 | jq -r '.object.sha // .object.url' 2>/dev/nullRepository: ethyca/fides
Length of output: 60
🌐 Web query:
peter-evans/repository-dispatch v3 commit sha github
💡 Result:
peter-evans/repository-dispatch@v3 (major tag) points to commit:
ff45666b9427631e3450c54a1bcbee4d9ff4d7c0. [1]
Source
Citations:
🏁 Script executed:
cat .github/workflows/claude-code-review.yml | head -80Repository: ethyca/fides
Length of output: 2732
Pin third-party action to a full commit SHA.
Line 59 uses a mutable major tag (@v3). Pinning to an immutable SHA improves supply-chain safety.
Suggested fix
- - name: Dispatch code review to talos
- uses: peter-evans/repository-dispatch@v3
+ - name: Dispatch code review to talos
+ uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| uses: peter-evans/repository-dispatch@v3 | |
| uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3 |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/claude-code-review.yml at line 59, The workflow uses a
mutable tag for the third-party action (uses:
peter-evans/repository-dispatch@v3); replace that tag with the action's full
commit SHA to pin the dependency. Locate the uses line referencing
peter-evans/repository-dispatch (the string "uses:
peter-evans/repository-dispatch@v3"), find the corresponding release/commit on
the peter-evans/repository-dispatch GitHub repo, and update the workflow to use
the immutable ref format (e.g., @<full-commit-sha>) instead of `@v3`.
Summary
repository_dispatch/code-reviewcommentRequired secrets
TALOS_DISPATCH_TOKENcontents:writeon ethyca/talosDependencies
asachs/claude-code-review-action(must merge first)Test plan
Generated with Claude Code
Summary by CodeRabbit
Release Notes