claude.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. name: Claude Code
  2. on:
  3. issue_comment:
  4. types: [created]
  5. pull_request_review_comment:
  6. types: [created]
  7. issues:
  8. types: [opened, assigned]
  9. pull_request_review:
  10. types: [submitted]
  11. jobs:
  12. claude:
  13. if: |
  14. (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
  15. (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
  16. (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
  17. (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
  18. runs-on: ubuntu-latest
  19. permissions:
  20. contents: read
  21. pull-requests: read
  22. issues: read
  23. id-token: write
  24. actions: read # Required for Claude to read CI results on PRs
  25. steps:
  26. - name: Checkout repository
  27. uses: actions/checkout@v4
  28. with:
  29. fetch-depth: 1
  30. - name: Run Claude Code
  31. id: claude
  32. uses: anthropics/claude-code-action@v1
  33. with:
  34. anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
  35. # This is an optional setting that allows Claude to read CI results on PRs
  36. additional_permissions: |
  37. actions: read
  38. # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
  39. # prompt: 'Update the pull request description to include a summary of changes.'
  40. # Optional: Add claude_args to customize behavior and configuration
  41. # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
  42. # or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
  43. # claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'