diff --git a/.github/workflows/claude-mention.yml b/.github/workflows/claude-mention.yml new file mode 100644 index 0000000..4370162 --- /dev/null +++ b/.github/workflows/claude-mention.yml @@ -0,0 +1,42 @@ +name: Claude Mention + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + pull_request_review: + types: [submitted] + issues: + types: [opened, assigned] + +jobs: + claude: + 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 == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + runs-on: ubuntu-latest + env: + ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} + ANTHROPIC_CUSTOM_HEADERS: | + Authorization: Bearer ${{ secrets.ANTHROPIC_API_KEY }} + x-databricks-use-coding-agent-mode: true + ANTHROPIC_DEFAULT_OPUS_MODEL: databricks-claude-opus-4-7 + ANTHROPIC_DEFAULT_SONNET_MODEL: databricks-claude-sonnet-4-6 + ANTHROPIC_DEFAULT_HAIKU_MODEL: databricks-claude-haiku-4-5 + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 1 + + - uses: anthropics/claude-code-action@787c5a0ce96a9a6cfb050ea0c8f4c05f2447c251 # v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + trigger_phrase: "@claude" diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml new file mode 100644 index 0000000..a6421a2 --- /dev/null +++ b/.github/workflows/claude-review.yml @@ -0,0 +1,48 @@ +name: Claude PR Review + +on: + pull_request: + types: [opened] + +jobs: + review: + runs-on: ubuntu-latest + env: + ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} + ANTHROPIC_CUSTOM_HEADERS: | + Authorization: Bearer ${{ secrets.ANTHROPIC_API_KEY }} + x-databricks-use-coding-agent-mode: true + ANTHROPIC_DEFAULT_OPUS_MODEL: databricks-claude-opus-4-7 + ANTHROPIC_DEFAULT_SONNET_MODEL: databricks-claude-sonnet-4-6 + ANTHROPIC_DEFAULT_HAIKU_MODEL: databricks-claude-haiku-4-5 + permissions: + contents: read + pull-requests: write + id-token: write + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 1 + + - uses: anthropics/claude-code-action@787c5a0ce96a9a6cfb050ea0c8f4c05f2447c251 # v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + prompt: | + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} + + Review this pull request. Focus on: + - Correctness — bugs, edge cases, broken assumptions + - Project conventions — match the patterns in neighboring code; this is a Python project using uv, ruff, pytest + - Security — secret handling, subprocess invocations, path traversal + - Tests — does new behavior have coverage in tests/? + + Be concise. Skip nitpicks. If the PR is small and clean, say so in one line rather than inventing feedback. + + The PR branch is already checked out in the current working directory. + Use `gh pr comment` for top-level feedback. + Use `mcp__github_inline_comment__create_inline_comment` (with `confirmed: true`) to highlight specific code issues. + Only post GitHub comments — don't submit review text as messages. + + claude_args: | + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"