Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/claude-mentions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Claude Mentions

# Scenario 1: @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'
uses: anthropics/claude-code-action@v1
with:
github_token: ${{ steps.app-token.outputs.token }}
use_bedrock: "true"
claude_args: "--model us.anthropic.claude-sonnet-4-5-20250929-v1:0 --max-turns 10"
70 changes: 70 additions & 0 deletions .github/workflows/claude-pr-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Claude PR Review

# Scenario 2: Automated reviews on PR open/update
# See: https://github.com/anthropics/claude-code-action/pull/614

on:
pull_request_target:
types: [opened, synchronize, ready_for_review, reopened]

permissions:
id-token: write
contents: write
pull-requests: write
issues: write

jobs:
claude-pr-review:
name: claude-pr-review
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: write
pull-requests: write
issues: write
actions: read
steps:
- name: Check if PR author is org member
id: check
run: |
PR_AUTHOR="${{ github.event.pull_request.author_association }}"
# Check if user is org member or owner
if [[ "$PR_AUTHOR" == "MEMBER" || "$PR_AUTHOR" == "OWNER" ]]; then
echo "is_member=true" >> $GITHUB_OUTPUT
else
echo "is_member=false" >> $GITHUB_OUTPUT
echo "⚠️ PR author is not a member of sigp organization. Skipping automated review."
exit 0
fi

- name: Checkout repository
if: steps.check.outputs.is_member == 'true'
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.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'
uses: anthropics/claude-code-action@v1
with:
github_token: ${{ steps.app-token.outputs.token }}
allowed_non_write_users: "*"
use_bedrock: "true"
claude_args: "--model us.anthropic.claude-sonnet-4-5-20250929-v1:0 --max-turns 10"
Loading