diff --git a/.github/workflows/claude.yaml b/.github/workflows/claude.yaml new file mode 100644 index 00000000..8b45bbfe --- /dev/null +++ b/.github/workflows/claude.yaml @@ -0,0 +1,66 @@ +name: Claude +on: + issues: + types: + - opened + - assigned + issue_comment: + types: + - created + pull_request: + paths: + - .github/workflows/claude.yaml + pull_request_review: + types: + - submitted + pull_request_review_comment: + types: + - created +concurrency: + group: ${{ github.workflow }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }} + cancel-in-progress: false +jobs: + default: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'issues' && contains(github.event.issue.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + github.event_name == 'pull_request' + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + pull-requests: write + issues: write + id-token: write + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 1 + - uses: aws-actions/configure-aws-credentials@v5 + with: + role-to-assume: arn:aws:iam::440849847947:role/claude-code-gha + role-session-name: gha-claude-code-action + aws-region: us-east-2 + - id: generate-token + uses: actions/create-github-app-token@v2 + with: + app-id: 1129585 + private-key: ${{ secrets.POSIT_CONNECT_PROJECTS_PEM }} + - uses: anthropics/claude-code-action@v1 + with: + use_bedrock: true + github_token: ${{ steps.generate-token.outputs.token }} + branch_prefix: claude- + additional_permissions: "actions: read" + track_progress: true + prompt: | + You are a helpful AI assistant for code reviews and issue triage. + Respond to comments and issues that mention you with relevant code suggestions or triage actions. + If you cannot assist, politely inform the user. In your responses, don't be overly complimentary. + Stick to the facts and provide actionable advice. + claude_args: | + --model us.anthropic.claude-sonnet-4-5-20250929-v1:0 + --fallback-model us.anthropic.claude-haiku-4-5-20251001-v1:0 + --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