diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 0000000..8ff912c --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,35 @@ +name: Claude + +# Comment "@claude ..." on an issue or PR (for example "@claude review this +# against CLAUDE.md") and Claude answers in the thread. Comment events run in +# this repo's context, so this also works on PRs from forks, where secrets are +# otherwise withheld. Only people with write access can trigger it. +# Needs the Claude GitHub app and a CLAUDE_CODE_OAUTH_TOKEN secret (claude setup-token). + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + pull_request_review: + types: [submitted] + +jobs: + claude: + if: >- + (github.event_name != 'pull_request_review' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + actions: read + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 1 + - uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}