From 0e470f3560af58f2ae64376cbc81d05075abe61a Mon Sep 17 00:00:00 2001 From: Pavan Soratur Date: Tue, 29 Jul 2025 17:36:02 -0700 Subject: [PATCH] ci: add Claude workflows for PR reviews and issue comments --- .github/workflows/claude-review.yml | 34 +++++++++++++++++++++++++ .github/workflows/claude.yml | 39 +++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/claude-review.yml create mode 100644 .github/workflows/claude.yml diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml new file mode 100644 index 0000000000..9c9adfef5a --- /dev/null +++ b/.github/workflows/claude-review.yml @@ -0,0 +1,34 @@ +name: Auto review PRs + +on: + pull_request: + types: [opened, ready_for_review] + +jobs: + auto-review: + if: github.event.pull_request.draft == false + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Auto review PR + uses: anthropics/claude-code-action@beta + with: + direct_prompt: | + Please review this PR. Look at the changes and provide thoughtful feedback on: + - Code quality and best practices + - Potential bugs or issues + - Performance considerations + - Security implications + - Documentation updates if needed + + Be constructive and specific in your feedback. Give inline comments where applicable. + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + allowed_tools: "mcp__github__add_pull_request_review_comment" diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 0000000000..a151dea02c --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,39 @@ +name: Claude Github Assistant + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +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'))) + ) && (github.event.pull_request.draft != true) + + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Github Assistant + id: claude + uses: anthropics/claude-code-action@beta + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}