Skip to content

ci: add claude PR review workflow using differential-review skill#10654

Closed
ziggie1984 wants to merge 1 commit intolightningnetwork:masterfrom
ziggie1984:claude-review-workflow
Closed

ci: add claude PR review workflow using differential-review skill#10654
ziggie1984 wants to merge 1 commit intolightningnetwork:masterfrom
ziggie1984:claude-review-workflow

Conversation

@ziggie1984
Copy link
Copy Markdown
Collaborator

Summary

  • Adds claude-review.yml workflow triggered by @claude review comments on PRs
  • Uses the differential-review skill from lightninglabs/agent-skills, cloned at runtime
  • Pins to anthropics/claude-code-action#963 fix commit to correctly handle fork PRs (the current @v1 fails with fatal: couldn't find remote ref on fork branches)
  • Excludes @claude review from claude.yml to prevent both workflows firing on the same comment
  • Includes workflow_dispatch for testing the workflow on this branch before merging

Test plan

  • Manually trigger via Actions → Claude PR Review → Run workflow on this branch with a PR number
  • Verify agent-skills clones correctly and differential-review skill is loaded
  • Comment @claude review on a fork PR and confirm it doesn't hit the branch fetch error
  • Remove workflow_dispatch block before final merge

@gemini-code-assist
Copy link
Copy Markdown

Note

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

Copy link
Copy Markdown
Collaborator

@saubyk saubyk left a comment

Choose a reason for hiding this comment

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

Just one clarification

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

Choose a reason for hiding this comment

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

Clarification: Does Claude need 'write' permission to post review comments on the issue or pr?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yes it is needed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes because we want to post comments on the PR

@ziggie1984 ziggie1984 force-pushed the claude-review-workflow branch 3 times, most recently from 883f5c6 to 86e3a2a Compare March 23, 2026 17:49
@lightninglabs-deploy
Copy link
Copy Markdown
Collaborator

@ziggie1984, remember to re-request review from reviewers when ready

@ziggie1984 ziggie1984 force-pushed the claude-review-workflow branch from f8d20b7 to a5eff49 Compare April 2, 2026 09:48
@ziggie1984
Copy link
Copy Markdown
Collaborator Author

New CI: Claude PR Review Workflow

This PR adds a new claude-review.yml workflow that is separate and independent from the existing claude.yml action already in the repo — it does not interfere with it in any way.

Why a separate workflow?

The existing claude-code-action has a known limitation: it does not support PRs whose head branch lives in a fork. Since most contributor PRs come from forks, the action simply cannot check out and review them.

This new workflow works around that by using gh pr checkout (fork-safe) to explicitly check out the PR branch before invoking Claude, making it work for both fork and non-fork PRs.

How it is triggered

The workflow activates on any of the following:

  • A comment containing @claude review is posted on a PR (issue comment or review comment)
  • Manually via workflow_dispatch by providing a PR number

It then runs our own /code-review slash command via claude -p and posts the findings back as a PR comment.

@erickcestari
Copy link
Copy Markdown
Collaborator

@claude are you being able to fetch the fork branch? Also review this change to check.

@claude
Copy link
Copy Markdown

claude bot commented Apr 2, 2026

Claude Code is working…

I'll analyze this and get back to you.

View job run

@ziggie1984 ziggie1984 added no-changelog CI continuous integration labels Apr 2, 2026
Wire up the claude-review workflow to invoke our own /code-review
slash command via claude -p, posting the findings as a PR comment.
@ziggie1984 ziggie1984 force-pushed the claude-review-workflow branch from a5eff49 to 96a81fd Compare April 2, 2026 13:51
@ziggie1984
Copy link
Copy Markdown
Collaborator Author

After looking into the security implications of running the Claude workflow in CI, we've identified a few concerns worth noting:

The current setup checks out untrusted fork code in the same job that holds the CLAUDE_CODE_OAUTH_TOKEN. This creates a potential attack vector where a malicious PR could include
tampered .claude/settings.json or CLAUDE.md files with hooks that exfiltrate the secret before Claude even processes the comment. Additionally, prompt injection via code comments is a
residual risk that is difficult to fully eliminate in a workflow-based approach.

Possible mitigations include adding an author_association guard, a precheck on modified Claude config files, or a full split-job architecture — but each comes with its own tradeoffs.

For now we have decided to run Claude reviews locally rather than through CI. This avoids the problem entirely — no secrets are exposed, no untrusted code runs in a shared environment,
and a human remains in the loop before anything gets posted. We can revisit automated CI integration once a more secure architecture is in place.

@ziggie1984 ziggie1984 closed this Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI continuous integration no-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants