Skip to content

Add Claude Code GitHub Workflow#3

Merged
ANcpLua merged 2 commits into
mainfrom
add-claude-github-actions-1777157670159
Apr 25, 2026
Merged

Add Claude Code GitHub Workflow#3
ANcpLua merged 2 commits into
mainfrom
add-claude-github-actions-1777157670159

Conversation

@ANcpLua
Copy link
Copy Markdown
Owner

@ANcpLua ANcpLua commented Apr 25, 2026

🤖 Installing Claude Code GitHub App

This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.

What is Claude Code?

Claude Code is an AI coding agent that can help with:

  • Bug fixes and improvements
  • Documentation updates
  • Implementing new features
  • Code reviews and suggestions
  • Writing tests
  • And more!

How it works

Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.

Important Notes

  • This workflow won't take effect until this PR is merged
  • @claude mentions won't work until after the merge is complete
  • The workflow runs automatically whenever Claude is mentioned in PR or issue comments
  • Claude gets access to the entire PR or issue context including files, diffs, and previous comments

Security

  • Our Anthropic API key is securely stored as a GitHub Actions secret
  • Only users with write access to the repository can trigger the workflow
  • All Claude runs are stored in the GitHub Actions run history
  • Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
  • We can add more allowed tools by adding them to the workflow file like:
allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)

There's more information in the Claude Code action repo.

After merging this PR, let's try mentioning @claude in a comment on any PR to get started!

Copilot AI review requested due to automatic review settings April 25, 2026 22:54
@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 25, 2026

Summary by CodeRabbit

  • Chores
    • Added automated code review workflow for pull requests powered by AI assistance.
    • Introduced AI-powered workflow integration that responds to repository interactions and comments.

Walkthrough

Two new GitHub Actions workflows are introduced to integrate Claude code review capabilities. The claude-code-review.yml workflow runs on pull request events and executes Claude code review using the Anthropics action. The claude.yml workflow responds to various GitHub events containing @claude mentions and invokes Claude Code via the same action, with appropriate read permissions for CI results.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/claude-code-review.yml, .github/workflows/claude.yml
Two new workflows integrating Anthropics Claude Code action. First targets PR events with /code-review prompt; second responds to comments/reviews with @claude mentions. Both use OAuth token from secrets and configure plugin source/identifier.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

area:infra


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Title check ❌ Error Title does not follow conventional commits format with required area prefix (feat|fix|refactor|chore|docs|test|ci|perf) and scope in parentheses. Rewrite title as 'ci(infra): add Claude Code GitHub workflow' or similar, following conventional commits format with area prefix and scope.
✅ Passed checks (7 passed)
Check name Status Explanation
Description check ✅ Passed Description is directly related to the changeset, providing comprehensive context about the Claude Code integration and workflow behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Otel Instrumentation Required ✅ Passed PR adds only GitHub Actions workflow files without registering new DI services, so OpenTelemetry instrumentation requirement does not apply.
No Unbounded Mcp Responses ✅ Passed PR contains only GitHub Actions workflow files with no MCP tool definitions under src/qyl.mcp/, satisfying the pass criterion of no MCP tool changes.
Duckdb Backpressure On Write Paths ✅ Passed PR adds only GitHub Actions workflow configuration files with no DuckDB operations or database interactions.
Cancellationtoken Threading ✅ Passed PR adds only GitHub Actions workflow YAML files; no C# source files or new public async methods in src/**/*.cs are introduced.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/claude-code-review.yml:
- Line 36: The workflow currently references the third-party GitHub Action using
a mutable tag "uses: anthropics/claude-code-action@v1"; replace that with the
action's full 40-character commit SHA (e.g. "uses:
anthropics/claude-code-action@<commit-sha>") to pin the dependency and eliminate
supply-chain risk—update the single line containing
anthropics/claude-code-action so it uses the exact commit SHA instead of `@v1`.

In @.github/workflows/claude.yml:
- Around line 8-10: The workflow currently triggers on issue assignment via the
entry "issues: types: [opened, assigned]" which causes duplicate runs; remove
"assigned" so the trigger becomes "issues: types: [opened]" to avoid
retriggering on assignment churn (leave "pull_request_review" unchanged); update
the "issues" types array in the workflow YAML accordingly.
- Around line 15-20: The workflow condition in .github/workflows/claude.yml
currently triggers on any `@claude` mention; change it to also require a trusted
author association so only repository members/owners/collaborators can trigger
secret-backed runs—i.e., extend each mention clause to AND a check for the
event's author association (use github.event.comment.author_association for
comment/pull_request_review_comment, github.event.review.user.login or
github.event.review.user.type/association for pull_request_review, and
github.event.issue.author_association or github.event.issue.user for issues) and
allow only values like "MEMBER", "OWNER", or "COLLABORATOR"; also ensure any
secret usage continues to avoid logging secrets and uses GITHUB_TOKEN where
possible.
- Line 35: Replace the mutable tag usage "uses:
anthropics/claude-code-action@v1" with the action's immutable 40-character
commit SHA (e.g., "uses: anthropics/claude-code-action@<full-commit-sha>");
locate the workflow line containing "uses: anthropics/claude-code-action@v1" in
the workflow file and update it to the corresponding commit SHA for that release
to ensure the third-party action is pinned immutably.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4c91a103-c7fb-4501-b1c5-ad2bfd7db693

📥 Commits

Reviewing files that changed from the base of the PR and between 735e264 and 29b8ae5.

📒 Files selected for processing (2)
  • .github/workflows/claude-code-review.yml
  • .github/workflows/claude.yml
📜 Review details
⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Agent
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (windows-latest)
🧰 Additional context used
📓 Path-based instructions (1)
.github/**

⚙️ CodeRabbit configuration file

GitHub Actions workflows. Review for: action version pinning (use SHA not tags for third-party actions), proper secret handling (no secrets in logs, use GITHUB_TOKEN where possible), unnecessary workflow triggers, and job dependency correctness. Flag missing concurrency groups on push-triggered workflows. Ensure matrix strategies cover the supported .NET TFMs.

Files:

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


- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/claude-code-review.yml | sed -n '30,45p'

Repository: ANcpLua/ANcpLua.Agents

Length of output: 863


🏁 Script executed:

grep -n "uses:" .github/workflows/claude-code-review.yml

Repository: ANcpLua/ANcpLua.Agents

Length of output: 153


🏁 Script executed:

head -n 50 .github/workflows/claude-code-review.yml

Repository: ANcpLua/ANcpLua.Agents

Length of output: 1499


Pin anthropics/claude-code-action to a commit SHA, not @v1.

Third-party action tags are mutable and create supply-chain risk. Use the full 40-character commit SHA.

Suggested fix
-        uses: anthropics/claude-code-action@v1
+        uses: anthropics/claude-code-action@<full-40-char-commit-sha>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claude-code-review.yml at line 36, The workflow currently
references the third-party GitHub Action using a mutable tag "uses:
anthropics/claude-code-action@v1"; replace that with the action's full
40-character commit SHA (e.g. "uses:
anthropics/claude-code-action@<commit-sha>") to pin the dependency and eliminate
supply-chain risk—update the single line containing
anthropics/claude-code-action so it uses the exact commit SHA instead of `@v1`.

Comment on lines +8 to +10
issues:
types: [opened, assigned]
pull_request_review:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Drop issues.assigned; it causes duplicate runs without a new @claude request.

Assignment churn can retrigger this job on old issue text and burn automation cycles.

Suggested fix
   issues:
-    types: [opened, assigned]
+    types: [opened]

As per coding guidelines, .github/** workflows should avoid “unnecessary workflow triggers.”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claude.yml around lines 8 - 10, The workflow currently
triggers on issue assignment via the entry "issues: types: [opened, assigned]"
which causes duplicate runs; remove "assigned" so the trigger becomes "issues:
types: [opened]" to avoid retriggering on assignment churn (leave
"pull_request_review" unchanged); update the "issues" types array in the
workflow YAML accordingly.

Comment on lines +15 to +20
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')))
runs-on: ubuntu-latest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add trusted-author gating before running Claude.

This condition allows any user who can post @claude to trigger a secret-backed automation path.

Suggested fix
   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')))
+      (
+        (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')))
+      ) &&
+      (
+        (github.event_name == 'issue_comment' && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) ||
+        (github.event_name == 'pull_request_review_comment' && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) ||
+        (github.event_name == 'pull_request_review' && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.review.author_association)) ||
+        (github.event_name == 'issues' && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.issue.author_association))
+      )

As per coding guidelines, .github/** workflows must enforce “proper secret handling (no secrets in logs, use GITHUB_TOKEN where possible)`.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claude.yml around lines 15 - 20, The workflow condition in
.github/workflows/claude.yml currently triggers on any `@claude` mention; change
it to also require a trusted author association so only repository
members/owners/collaborators can trigger secret-backed runs—i.e., extend each
mention clause to AND a check for the event's author association (use
github.event.comment.author_association for comment/pull_request_review_comment,
github.event.review.user.login or github.event.review.user.type/association for
pull_request_review, and github.event.issue.author_association or
github.event.issue.user for issues) and allow only values like "MEMBER",
"OWNER", or "COLLABORATOR"; also ensure any secret usage continues to avoid
logging secrets and uses GITHUB_TOKEN where possible.


- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/claude.yml

Repository: ANcpLua/ANcpLua.Agents

Length of output: 2302


🌐 Web query:

GitHub Actions third-party action pinning SHA vs tag best practices security

💡 Result:

For GitHub Actions, especially third-party actions, the best security practice is to pin to a full-length commit SHA rather than a tag. SHAs are immutable, preventing supply chain attacks where tags can be force-pushed to malicious commits. Tags like @v1 are mutable and risky unless you fully trust the maintainer. Official GitHub recommendation from docs: "Pin actions to a full-length commit SHA. Pinning an action to a full-length commit SHA is currently the only way to use an action as an immutable release." Use the format: uses: actions/checkout@192f6d4 # v4.1.1 (add comment for readability). For trusted creators (e.g., GitHub's own actions with verified badge), tags may be acceptable for convenience, but SHA is always more secure. GitHub provides org/repo-level policies to enforce SHA pinning (introduced 2025), which checks the full dependency tree including sub-actions. Use Dependabot to auto-update SHA-pinned actions: it creates PRs with new SHAs and version comments. Tools like pin-github-action or ensure-sha-pinned-actions help automate pinning and enforcement. Example workflow step: uses: actions/checkout@192f6d4 # v4.1.1 Avoid @main, @latest, or unpinned tags for third-party actions.

Citations:


Pin anthropics/claude-code-action to a commit SHA.

Third-party actions must use immutable commit SHAs, not tags. @v1 is mutable and can be force-pushed to malicious commits. Replace with the full 40-character commit SHA for that release.

Suggested fix
-        uses: anthropics/claude-code-action@v1
+        uses: anthropics/claude-code-action@<full-40-char-commit-sha>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: anthropics/claude-code-action@v1
uses: anthropics/claude-code-action@abc123def456abc123def456abc123def456abc1
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claude.yml at line 35, Replace the mutable tag usage
"uses: anthropics/claude-code-action@v1" with the action's immutable
40-character commit SHA (e.g., "uses:
anthropics/claude-code-action@<full-commit-sha>"); locate the workflow line
containing "uses: anthropics/claude-code-action@v1" in the workflow file and
update it to the corresponding commit SHA for that release to ensure the
third-party action is pinned immutably.

@ANcpLua ANcpLua merged commit 629dca0 into main Apr 25, 2026
25 checks passed
@ANcpLua ANcpLua deleted the add-claude-github-actions-1777157670159 branch April 25, 2026 22:58
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29b8ae5644

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +22 to +24
contents: read
pull-requests: read
issues: read
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Grant Claude workflow write permissions

This @claude interactive workflow is configured with read-only contents, pull-requests, and issues, which prevents Claude from performing core actions users will request (posting replies, opening/updating PRs, committing changes). In practice, commands that require repository mutation will fail at runtime even though the workflow is intended for assistant automation.

Useful? React with 👍 / 👎.

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Allow review job to write pull-request comments

The review workflow sets pull-requests: read, but automated code review needs to publish findings back to the PR (inline comments or summary comments). With read-only PR scope, the job can analyze changes but cannot deliver review output to the pull request, which breaks the primary outcome of this workflow.

Useful? React with 👍 / 👎.

id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard OAuth secret usage on fork pull requests

This workflow runs on pull_request and unconditionally requires secrets.CLAUDE_CODE_OAUTH_TOKEN; for PRs opened from forks, repository secrets are not provided, so this value is empty and the action fails. That means external-contributor PRs will consistently hit a broken review run unless the job is gated to same-repo branches or migrated to a safe pull_request_target pattern.

Useful? React with 👍 / 👎.

@ANcpLua ANcpLua review requested due to automatic review settings April 25, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant