Skip to content

refactor: claude-mentions #1734

refactor: claude-mentions

refactor: claude-mentions #1734

Workflow file for this run

name: Claude Mentions
# @claude mentions on issues and PR comments
# See: https://github.com/anthropics/claude-code-action/pull/614
on:
issue_comment:
types: [created, edited]
pull_request_review_comment:
types: [created, edited]
permissions:
id-token: write
contents: write
pull-requests: write
issues: write
jobs:
claude-mentions:
if: contains(github.event.comment.body, '@claude')
name: claude-mentions
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: write
pull-requests: write
issues: write
actions: read
steps:
- name: Check if user is org member
id: check
run: |
COMMENT_AUTHOR="${{ github.event.comment.author_association || github.event.review.author_association }}"
# Check if user is org member or owner
if [[ "$COMMENT_AUTHOR" == "MEMBER" || "$COMMENT_AUTHOR" == "OWNER" ]]; then
echo "is_member=true" >> $GITHUB_OUTPUT
else
echo "is_member=false" >> $GITHUB_OUTPUT
echo "⚠️ User is not a member of sigp organization. Skipping."
exit 1
fi
- name: Get PR info for fork support
if: steps.check.outputs.is_member == 'true' && github.event.issue.pull_request
id: pr-info
run: |
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
echo "pr_head_owner=$(echo "$PR_DATA" | jq -r '.head.repo.owner.login')" >> $GITHUB_OUTPUT
echo "pr_head_repo=$(echo "$PR_DATA" | jq -r '.head.repo.name')" >> $GITHUB_OUTPUT
echo "pr_head_ref=$(echo "$PR_DATA" | jq -r '.head.ref')" >> $GITHUB_OUTPUT
echo "is_fork=$(echo "$PR_DATA" | jq -r '.head.repo.fork')" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}
- name: Checkout repository
if: steps.check.outputs.is_member == 'true'
uses: actions/checkout@v4
with:
repository: ${{ github.event.issue.pull_request && steps.pr-info.outputs.is_fork == 'true' && format('{0}/{1}', steps.pr-info.outputs.pr_head_owner, steps.pr-info.outputs.pr_head_repo) || github.repository }}
ref: ${{ github.event.issue.pull_request && steps.pr-info.outputs.pr_head_ref || github.ref }}
fetch-depth: 0
- name: Generate GitHub App token
if: steps.check.outputs.is_member == 'true'
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Configure AWS Credentials (OIDC)
if: steps.check.outputs.is_member == 'true'
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: us-west-2
- name: Run Claude Code Action
if: steps.check.outputs.is_member == 'true'
timeout-minutes: 15
uses: anthropics/claude-code-action@v1.0.52
with:
github_token: ${{ steps.app-token.outputs.token }}
use_bedrock: "true"
prompt: |
REPO: ${{ github.repository }}
Be precise and concise. No praise. Focus on actionable issues only.
Review ONLY the PR diff. Do not flag pre-existing issues.
If no significant issues are found, say so briefly and move on.
When reviewing PRs, focus on these areas in priority order:
1. **Security** — vulnerabilities, unsafe code, input validation, auth logic
2. **Correctness** — logic errors, race conditions, edge cases, off-by-one errors
3. **Performance** — bottlenecks, unnecessary allocations, resource leaks
4. **Error Handling** — missing error paths, unwrap/expect in non-test code, silent failures
5. **Rust Idioms** — non-idiomatic patterns, unnecessary clones, misuse of ownership/borrowing
6. **Design** — incorrect abstractions, module boundary violations, missing trait bounds
7. **Testing** — missing coverage for new code paths, untested edge cases
Do NOT comment on:
- Style or formatting (handled by rustfmt/clippy)
- Minor naming preferences
- TODOs, FIXMEs, or documentation formatting
- Code with lint suppression comments (already acknowledged)
- Pre-existing issues not introduced by this PR
- Suggestions that are nice-to-have but not required for correctness
Use inline comments for specific issues with concrete suggestions.
Use a single top-level comment for summary only if there are findings.
claude_args: |
--max-turns 50
--model us.anthropic.claude-opus-4-6-v1