-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add Claude Code GitHub Workflow #158
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 |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: Claude Code Review | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, ready_for_review, reopened] | ||
| # Optional: Only run on specific file changes | ||
| # paths: | ||
| # - "src/**/*.ts" | ||
| # - "src/**/*.tsx" | ||
| # - "src/**/*.js" | ||
| # - "src/**/*.jsx" | ||
|
|
||
| jobs: | ||
| claude-review: | ||
| # Optional: Filter by PR author | ||
| # if: | | ||
| # github.event.pull_request.user.login == 'external-contributor' || | ||
| # github.event.pull_request.user.login == 'new-developer' || | ||
| # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' | ||
|
|
||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write | ||
|
Comment on lines
+22
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== Files ==\n'
git ls-files '.github/workflows/claude-code-review.yml' '.github/workflows/claude.yml' || true
printf '\n== claude-code-review.yml ==\n'
cat -n .github/workflows/claude-code-review.yml
printf '\n== claude.yml ==\n'
cat -n .github/workflows/claude.yml
printf '\n== Search for workflow/action usage ==\n'
rg -n "pull-requests:|issues:|actions:|anthropic|claude|checkout@" .github/workflows .github -g '*.yml' -g '*.yaml' || trueRepository: ophi-dev/antlr-rust-runtime Length of output: 12325 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "hello"Repository: ophi-dev/antlr-rust-runtime Length of output: 171 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,220p' .github/workflows/claude-code-review.yml
printf '\n---\n'
sed -n '1,220p' .github/workflows/claude.ymlRepository: ophi-dev/antlr-rust-runtime Length of output: 3489 🌐 Web query:
💡 Result: To use the Citations:
Grant the Claude workflows the write scopes they require.
🧰 Tools🪛 zizmor (1.26.1)[warning] 24-24: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment (undocumented-permissions) 📍 Affects 2 files
🤖 Prompt for AI Agents |
||
|
|
||
|
Comment on lines
+21
to
+27
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Run Claude Code Review | ||
| id: claude-review | ||
| uses: anthropics/claude-code-action@v1 | ||
|
Comment on lines
+29
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n## Workflow files\n'
git ls-files .github/workflows/claude-code-review.yml .github/workflows/claude.yml
printf '\n## Relevant lines\n'
for f in .github/workflows/claude-code-review.yml .github/workflows/claude.yml; do
echo "---- $f ----"
cat -n "$f" | sed -n '1,120p'
done
printf '\n## Search for other action pins in workflows\n'
rg -n 'uses:\s*[^@]+@' .github/workflows -g '*.yml' -g '*.yaml'Repository: ophi-dev/antlr-rust-runtime Length of output: 7088 Pin these workflow actions to immutable SHAs.
🧰 Tools🪛 zizmor (1.26.1)[warning] 29-32: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 30-30: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 36-36: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 📍 Affects 2 files
🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
| with: | ||
|
Comment on lines
+34
to
+37
|
||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For Useful? React with 👍 / 👎. |
||
| plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' | ||
| plugins: 'code-review@claude-code-plugins' | ||
| prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}' | ||
|
Comment on lines
+36
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== workflow =="
sed -n '1,120p' .github/workflows/claude-code-review.yml
echo
echo "== repo references =="
rg -n --hidden --glob '!**/.git/**' --glob '!**/node_modules/**' "code-review|claude_args|--comment|plugin_marketplaces|plugins:" .github/workflows . || trueRepository: ophi-dev/antlr-rust-runtime Length of output: 2890 🏁 Script executed: #!/bin/bash
set -euo pipefail
wc -l .github/workflows/claude-code-review.yml
printf '\n'
cat -n .github/workflows/claude-code-review.yml | sed -n '1,120p'Repository: ophi-dev/antlr-rust-runtime Length of output: 1951 🌐 Web query:
💡 Result: Claude Code provides a dedicated /code-review command designed to analyze diffs for correctness bugs, style issues, and efficiency improvements [1][2][3]. When using this command, the --comment flag is specifically used to post findings as inline comments directly on a GitHub Pull Request [1][2]. Usage and Integration: - Local Execution: The /code-review command is run within a Claude Code terminal session [1][3]. It automatically detects the open GitHub pull request associated with your current branch, provided the GitHub CLI (gh) is installed [2]. - Command Syntax: To run a review and post findings as inline comments, use: /code-review --comment [2][4] - Modifiers: You can specify effort levels (e.g., /code-review high --comment) to control the depth of the analysis [2][3]. - Alternative (GitHub App/Actions): For team-wide automation, you can use the managed Claude GitHub App (via Anthropic's organization settings) to trigger reviews on PR events (creation, push, or manual comment), or use the anthropics/claude-code-action in self-hosted GitHub Actions workflows to achieve similar inline feedback [1][3]. The --comment flag effectively bridges the local CLI environment with GitHub's code review interface, allowing for seamless integration into development workflows without leaving the terminal [2][3]. Citations:
🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,120p' .github/workflows/claude.ymlRepository: ophi-dev/antlr-rust-runtime Length of output: 2051 Run 🧰 Tools🪛 zizmor (1.26.1)[error] 36-36: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With this prompt, the automatic Useful? React with 👍 / 👎. |
||
| # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md | ||
| # or https://code.claude.com/docs/en/cli-reference for available options | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Claude Code | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| issues: | ||
| types: [opened, assigned] | ||
|
Comment on lines
+8
to
+9
|
||
| 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 == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) | ||
|
Comment on lines
+15
to
+19
Comment on lines
+8
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect the workflow around the referenced lines.
git ls-files .github/workflows/claude.yml
wc -l .github/workflows/claude.yml
cat -n .github/workflows/claude.yml | sed -n '1,220p'Repository: ophi-dev/antlr-rust-runtime Length of output: 2462 Remove the 🧰 Tools🪛 zizmor (1.26.1)[info] 14-14: workflow or action definition without a name (anonymous-definition): this job (anonymous-definition) 🤖 Prompt for AI Agents |
||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write | ||
| actions: read # Required for Claude to read CI results on PRs | ||
|
Comment on lines
+21
to
+26
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Run Claude Code | ||
| id: claude | ||
| uses: anthropics/claude-code-action@v1 | ||
|
Comment on lines
+29
to
+35
|
||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
|
|
||
| # This is an optional setting that allows Claude to read CI results on PRs | ||
| additional_permissions: | | ||
| actions: read | ||
| # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it. | ||
| # prompt: 'Update the pull request description to include a summary of changes.' | ||
|
|
||
| # Optional: Add claude_args to customize behavior and configuration | ||
| # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md | ||
| # or https://code.claude.com/docs/en/cli-reference for available options | ||
| # claude_args: '--allowed-tools Bash(gh pr *)' | ||
|
|
||
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.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: ophi-dev/antlr-rust-runtime
Length of output: 2068
Cancel stale reviews per pull request. Add a workflow-level
concurrencygroup withcancel-in-progress: trueso newersynchronizeruns replace older Claude review runs and avoid stale duplicate comments.🧰 Tools
🪛 YAMLlint (1.37.1)
[warning] 3-3: truthy value should be one of [false, true]
(truthy)
🪛 zizmor (1.26.1)
[warning] 3-11: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting
(concurrency-limits)
🤖 Prompt for AI Agents
Source: Linters/SAST tools