|
| 1 | +name: Claude |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + pull_request_review_comment: |
| 7 | + types: [created] |
| 8 | + issues: |
| 9 | + types: [opened, assigned] |
| 10 | + pull_request_review: |
| 11 | + types: [submitted] |
| 12 | + pull_request: |
| 13 | + # For testing, run when workflow file is changed |
| 14 | + paths: |
| 15 | + - '.github/workflows/claude.yaml' |
| 16 | + |
| 17 | +jobs: |
| 18 | + claude-code-action: |
| 19 | + if: | |
| 20 | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || |
| 21 | + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || |
| 22 | + (github.event_name == 'issues' && contains(github.event.issue.body, '@claude')) || |
| 23 | + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || |
| 24 | + github.event_name == 'pull_request' |
| 25 | + runs-on: ubuntu-latest |
| 26 | + timeout-minutes: 30 |
| 27 | + permissions: |
| 28 | + contents: read |
| 29 | + pull-requests: write |
| 30 | + issues: write |
| 31 | + id-token: write |
| 32 | + steps: |
| 33 | + - name: Checkout repository |
| 34 | + uses: actions/checkout@v5 |
| 35 | + with: |
| 36 | + fetch-depth: 1 |
| 37 | + |
| 38 | + - uses: aws-actions/configure-aws-credentials@v5 |
| 39 | + with: |
| 40 | + role-to-assume: arn:aws:iam::440849847947:role/claude-code-gha |
| 41 | + role-session-name: gha-claude-code-action |
| 42 | + aws-region: us-east-2 |
| 43 | + |
| 44 | + - name: Generate token for GitHub App |
| 45 | + id: generate-token |
| 46 | + uses: actions/create-github-app-token@v2 |
| 47 | + with: |
| 48 | + app-id: 1129585 |
| 49 | + private-key: ${{ secrets.POSIT_CONNECT_PROJECTS_PEM }} |
| 50 | + |
| 51 | + - name: Run Claude Code Action |
| 52 | + uses: anthropics/claude-code-action@v1 |
| 53 | + with: |
| 54 | + use_bedrock: true |
| 55 | + github_token: ${{ steps.generate-token.outputs.token }} |
| 56 | + branch_prefix: "claude-" |
| 57 | + additional_permissions: "actions: read" |
| 58 | + track_progress: true |
| 59 | + prompt: | |
| 60 | + You are a helpful AI assistant for code reviews and issue triage. |
| 61 | + Respond to comments and issues that mention you with relevant code suggestions or triage actions. |
| 62 | + If you cannot assist, politely inform the user. In your responses, don't be overly complimentary. |
| 63 | + stick to the facts and provide actionable advice. |
| 64 | + claude_args: | |
| 65 | + --model us.anthropic.claude-sonnet-4-5-20250929-v1:0 |
| 66 | + --fallback-model us.anthropic.claude-haiku-4-5-20251001-v1:0 |
| 67 | + --allowedTools mcp__github__create_pull_request,mcp__github__create_issue,mcp__github__search_issues,mcp__github__update_issue,mcp__github__create_pending_pull_request_review,mcp__github__add_pull_request_review_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff |
0 commit comments