Skip to content

Commit b597b66

Browse files
Update claude code workflow (#150)
1 parent 6c54d07 commit b597b66

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ on:
1212

1313
jobs:
1414
claude-review:
15-
# Optional: Filter by PR author
16-
# if: |
17-
# github.event.pull_request.user.login == 'external-contributor' ||
18-
# github.event.pull_request.user.login == 'new-developer' ||
19-
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
15+
# Skip review for automated "Version Packages" PRs created by changesets
16+
if: github.event.pull_request.title != 'Version Packages'
2017

2118
runs-on: ubuntu-latest
2219
permissions:
@@ -37,21 +34,34 @@ jobs:
3734
with:
3835
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
3936
prompt: |
40-
REPO: ${{ github.repository }}
41-
PR NUMBER: ${{ github.event.pull_request.number }}
37+
Review PR #${{ github.event.pull_request.number }}.
4238
43-
Please review this pull request and provide feedback on:
44-
- Code quality and best practices
45-
- Potential bugs or issues
46-
- Performance considerations
47-
- Security concerns
48-
- Test coverage
39+
Read CLAUDE.md for project conventions and architecture patterns. Focus on substantive issues:
40+
- Code quality, potential bugs, architecture alignment
41+
- Testing coverage
4942
50-
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
43+
BE CONCISE. Only report actual issues worth addressing - skip generic praise and obvious observations.
44+
If the PR looks good, just say so briefly.
5145
52-
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
46+
**Posting your review:**
47+
1. First, check if you've already posted a review comment on this PR (find the comment ID):
48+
```bash
49+
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments --jq '.[] | select(.user.login == "claude[bot]" or .user.login == "github-actions[bot]") | select(.body | startswith("## Claude Code Review")) | .id' | head -1)
50+
```
51+
52+
2. If COMMENT_ID exists (non-empty), UPDATE that comment:
53+
```bash
54+
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH -f body="YOUR_REVIEW_CONTENT_HERE"
55+
```
56+
57+
3. If COMMENT_ID is empty, create a new comment:
58+
```bash
59+
gh pr comment ${{ github.event.pull_request.number }} --body "YOUR_REVIEW_CONTENT_HERE" --repo ${{ github.repository }}
60+
```
61+
62+
Start your review with "## Claude Code Review" heading so it can be identified and updated on subsequent runs.
5363
5464
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
5565
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
56-
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
66+
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh api:*)"'
5767

.github/workflows/claude.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,21 @@ jobs:
3535
uses: anthropics/claude-code-action@v1
3636
with:
3737
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
38+
track_progress: true
3839

3940
# This is an optional setting that allows Claude to read CI results on PRs
4041
additional_permissions: |
4142
actions: read
4243
43-
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44-
# prompt: 'Update the pull request description to include a summary of changes.'
44+
# Custom prompt that ensures Claude reads CLAUDE.md first
45+
prompt: |
46+
REPO: ${{ github.repository }}
47+
ISSUE/PR: #${{ github.event.issue.number || github.event.pull_request.number }}
48+
49+
IMPORTANT: Before starting any work, read the CLAUDE.md file at the root of this repository. It contains critical project conventions, architecture patterns, and development guidelines that you must follow.
50+
51+
After reading CLAUDE.md, proceed with the following task:
52+
${{ github.event.comment.body || github.event.issue.body || github.event.review.body }}
4553
4654
# Optional: Add claude_args to customize behavior and configuration
4755
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md

0 commit comments

Comments
 (0)