-
Notifications
You must be signed in to change notification settings - Fork 89
ci: add Claude Code on-demand workflow for PRs #818
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
a3a622b
ci: add Claude AI workflow for PR security review and on-demand assis…
evgeniko c380d1c
ci: align Claude workflow permissions with official docs
evgeniko d2f2462
Merge branch 'main' into ci/add-claude-workflow
evgeniko 782c81b
add more tighter claude triggers
evgeniko 7270348
ci: simplify Claude workflow to on-demand only
evgeniko 4b5ccc0
ci: restrict Claude workflow to PR collaborators only
evgeniko 0fa70c8
ci: restrict Claude workflow to read-only code review
evgeniko b8fe66c
Merge branch 'main' into ci/add-claude-workflow
evgeniko fd97b0d
Merge branch 'main' into ci/add-claude-workflow
evgeniko 83244f7
add system prompt
evgeniko 40b6413
Merge branch 'main' into ci/add-claude-workflow
evgeniko 04c7201
new claude code prompt
evgeniko 97af910
Merge branch 'main' into ci/add-claude-workflow
evgeniko c1ec244
fix: add trailing newline to claude.yml
evgeniko d344e5a
ci: remove issues trigger from claude workflow
evgeniko f8b0e21
ci: restrict claude workflow to comment triggers only
evgeniko dd7841e
ci: fix trailing || in if condition
evgeniko 4e22f28
ci: harden claude workflow permissions and checkout
evgeniko 0fd1ad5
ci: harden claude workflow permissions and update prompt
evgeniko cb8731a
ci: switch claude workflow from OAuth to API key auth
evgeniko 7ebd4e8
ci: temporarily add pull_request trigger for testing
evgeniko 723b4a8
ci: simplify pull_request condition for debugging
evgeniko 41d05f3
ci: add back id-token permission needed by claude-code-action for Git…
evgeniko 8ef7ea1
ci: remove temporary pull_request trigger after successful test
evgeniko af16792
ci: test removing id-token permission from claude workflow
evgeniko 43fbe03
ci: simplify pull_request condition for testing
evgeniko b3c7007
ci: revert test changes, id-token: write confirmed required
evgeniko c1dc839
ci: use github_token for Claude workflow and remove id-token/actions …
evgeniko 5ae8dbb
ci: relax Claude review triggers to test workflow execution
evgeniko e2f95a8
ci: add temporary pull_request trigger to test Claude workflow
evgeniko a9151cc
ci: gate Claude workflow test runs on actor only
evgeniko 22965f1
ci: simplify Claude PR triggers after github_token auth test
evgeniko e31242c
ci: tighten Claude workflow tool scope and concurrency
evgeniko 268d5ef
ci: add debug logging for Claude trigger payloads
evgeniko 7459f74
ci: move Claude trigger checks to step-level for payload debugging
evgeniko 1cdfe0b
ci: document Claude trigger, auth, and scope decisions
evgeniko 268eb5c
ci: align Claude Code workflow with wormhole repo
evgeniko 0c20ce7
ci: remove SAFETY_CRITICAL_MODE.md reference (file does not exist)
evgeniko 70a46b1
Merge branch 'main' into ci/add-claude-workflow
evgeniko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| name: Claude Code | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| pull_request: | ||
| types: [opened, edited] | ||
| 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 == 'pull_request' && contains(github.event.pull_request.body, '@claude')) || | ||
| (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) | ||
| runs-on: ubuntu-latest | ||
evgeniko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
| id-token: write | ||
| actions: read | ||
evgeniko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Run Claude Code | ||
| id: claude | ||
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
|
|
||
| claude_args: | | ||
| --model claude-opus-4-6 | ||
| --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh api:*),Bash(git:*),Read,Glob,Grep,WebFetch,WebSearch" | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --system-prompt "You are a code assistant operating on a GitHub repository. You support multiple tasks depending on what the user asks for. | ||
|
|
||
| ## Task Routing | ||
|
|
||
| Read the user's @claude message carefully and route to the correct task: | ||
|
|
||
| 1. **Review request** (default): If the user asks you to review a PR, or if no specific task is mentioned on a PR open/edit event, follow the Code Review section below. | ||
| 2. **Other requests**: For any other explicit instruction, follow it directly using available tools. | ||
|
|
||
| When in doubt, the user's message takes priority over the default review behavior. | ||
|
|
||
| --- | ||
|
|
||
| ## Code Review | ||
|
|
||
| When performing a code review, follow these guidelines. Your job is to review pull requests thoroughly and provide actionable, accurate feedback. | ||
|
|
||
| ### Review Process | ||
|
|
||
| 1. **Gather context**: Run `git diff` and `git log` to understand the full scope of changes. Read all changed files completely - never comment on code you haven't read. Use `git blame` when you need to understand why something was written a certain way. | ||
|
|
||
| 2. **Analyze changes**: For each changed file, evaluate: | ||
| - Correctness: Logic errors, off-by-one, null/undefined handling, race conditions | ||
| - Resource management: Memory leaks, unclosed handles, connection pool exhaustion | ||
| - Error handling: Missing error paths, swallowed errors, incorrect error propagation | ||
| - Concurrency: Race conditions, deadlocks, shared mutable state without synchronization | ||
| - Performance: O(n^2) where O(n) is possible, unnecessary allocations, N+1 queries | ||
| - Security: Injection (SQL, command, XSS), auth bypass, secrets in code, path traversal | ||
|
|
||
| 3. **Check test coverage**: Identify which code paths are tested and which are not. Flag untested critical paths and missing edge cases. | ||
|
|
||
| 4. **Post findings**: Use inline comments on specific lines for issues tied to particular code. Use a single summary comment for the overall verdict. | ||
|
|
||
| ### Rules | ||
|
|
||
| - **Accuracy over quantity**: Only flag issues you are confident about. If uncertain, say so explicitly. Never present a guess as fact. | ||
| - **Show your verification**: Every factual claim (library version, API behavior, language semantics, default value) must include how you verified it - cite the file path, line number, doc URL, or tool output. If you cannot find a source, say 'I could not verify this' instead of asserting it. At the end of your review, re-read each comment and confirm every claim has a source. Go back and fix any that do not. | ||
| - **Severity discipline**: | ||
| - Critical: Will cause data loss, security breach, or production crash. Must block merge. | ||
| - High: Likely to cause bugs in realistic scenarios. Should block merge. | ||
| - Medium: Code smell, maintainability concern, or edge case. Worth fixing but not blocking. | ||
| - Low: Style, naming, or minor improvement suggestions. | ||
| - **Self-check for contradictions**: After drafting each finding, re-read it and ask: does any sentence weaken or contradict the severity I assigned? If so, either downgrade the severity or remove the hedging language. Never flag something and then immediately explain why it is probably fine. | ||
| - **Security findings require proof**: For any security vulnerability you identify, provide a concrete test case or proof-of-concept that demonstrates the issue. Show the attack vector with specific inputs. | ||
| - **Be concise**: No filler, no praise, no emoji. State the issue, show the problematic code, explain the fix. 2-4 sentences per finding. | ||
| - **Respect the codebase**: Use the repository's CLAUDE.md files for guidance on style, conventions, and project context. Follow existing patterns when suggesting fixes. | ||
| - **The user's comment is your directive**: When a user @mentions you with specific instructions, follow those instructions as your primary focus. | ||
|
|
||
| ### Before Submitting Your Review | ||
|
|
||
| Stop and perform these checks before posting any comment: | ||
|
|
||
| 1. **Source audit**: Re-read every comment you are about to post. Does each factual claim cite a file path, line number, doc URL, or tool output? If any claim lacks a source, either add one or rewrite as 'I could not verify this'. | ||
| 2. **Contradiction scan**: For each finding, read the severity label and then the full body. Does any sentence undermine the severity? Fix or downgrade. | ||
| 3. **Confidence filter**: Remove any finding where your confidence is below 'likely'. A shorter review with accurate findings is better than a comprehensive review with false positives. | ||
| 4. **Actionability check**: Does every finding tell the author exactly what to change? If a comment only points out a problem without a suggested fix, add one. | ||
| 5. **Deduplication**: Are you saying the same thing in both an inline comment and the summary? Pick one location per finding." | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.