-
Notifications
You must be signed in to change notification settings - Fork 1
feat: split Claude workflow into interactive + issue automation jobs #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| # AI-assisted code review via Claude Code Action on PRs. | ||
| # Issue automation: implement, open PR, self-review, check CI, notify maintainer. | ||
| # Standard: https://github.com/petry-projects/.github/blob/main/standards/ci-standards.md#4-claude-code-claudeyml | ||
| name: Claude Code | ||
|
|
||
| on: | ||
|
|
@@ -14,6 +17,7 @@ on: | |
| permissions: {} | ||
|
|
||
| jobs: | ||
| # Interactive mode: PR reviews and @claude mentions | ||
| claude: | ||
| if: >- | ||
| (github.event_name == 'pull_request' && | ||
|
|
@@ -23,25 +27,71 @@ jobs: | |
| contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) || | ||
| (github.event_name == 'pull_request_review_comment' && | ||
| contains(github.event.comment.body, '@claude') && | ||
| contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) || | ||
| (github.event_name == 'issues' && github.event.action == 'labeled' && | ||
| github.event.label.name == 'claude') | ||
| contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
| permissions: | ||
| # write required for issue-triggered branch creation | ||
| contents: write | ||
| id-token: write | ||
| pull-requests: write | ||
| issues: write | ||
| actions: read | ||
| checks: read | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 1 | ||
| - name: Run Claude Code | ||
| if: github.event_name != 'pull_request' || github.event.pull_request.user.login != 'dependabot[bot]' | ||
| uses: anthropics/claude-code-action@6e2bd52842c65e914eba5c8badd17560bd26b5de # v1.0.89 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| additional_permissions: | | ||
| actions: read | ||
| checks: read | ||
|
|
||
| # Automation mode: issue-triggered work — implement, open PR, review, and notify | ||
| claude-issue: | ||
| if: >- | ||
| github.event_name == 'issues' && github.event.action == 'labeled' && | ||
| github.event.label.name == 'claude' | ||
| concurrency: | ||
| group: claude-issue-${{ github.event.issue.number }} | ||
| cancel-in-progress: true | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
| pull-requests: write | ||
| issues: write | ||
| actions: read | ||
| checks: read | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 1 | ||
| - name: Run Claude Code | ||
| uses: anthropics/claude-code-action@6e2bd52842c65e914eba5c8badd17560bd26b5de # v1.0.89 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| label_trigger: "claude" | ||
| track_progress: "true" | ||
| additional_permissions: | | ||
| actions: read | ||
| checks: read | ||
| claude_args: | | ||
| --allowedTools "Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr comment:*),Bash(gh issue comment:*),Bash(gh run view:*),Bash(gh run watch:*),Edit,Write" | ||
| prompt: | | ||
| Implement a fix for issue #${{ github.event.issue.number }}. | ||
|
|
||
| After implementing: | ||
| 1. Create a pull request with a clear title and description. Include "Closes #${{ github.event.issue.number }}" in the PR body. | ||
| 2. Self-review your own PR — look for bugs, style issues, missed edge cases, and test gaps. If you find problems, push fixes. | ||
| 3. Review all comments and review threads on the PR. For each one: | ||
| - If you can address the feedback, make the fix, push, and mark the conversation as resolved. | ||
| - If the comment requires human judgment, leave a reply explaining what you need. | ||
| 4. Check CI status. If CI fails, read the logs, fix the issues, and push again. Repeat until CI passes. | ||
| 5. When CI is green, all actionable review comments are resolved, and the PR is ready, read the CODEOWNERS file and leave a comment tagging the relevant code owners to review and merge. | ||
|
Comment on lines
+85
to
+97
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: this
actions/checkoutpin uses the same commit hash that other workflows annotate as# v4, so the# v6.0.2comment is likely inaccurate. Align the inline version comment to avoid confusion when updating pins later.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SHA
de0fac2e4500dabe0009e67214ff5f5447ce83ddmaps toactions/checkoutv6.0.2, not v4. The comment is correct.