Skip to content

docs(openspec): propose the agent command and the Vale authoring path #306

docs(openspec): propose the agent command and the Vale authoring path

docs(openspec): propose the agent command and the Vale authoring path #306

name: Claude Code Review (on demand)
# On-demand, review-ONLY code review. This is a PUBLIC repo, so there is
# deliberately NO auto-review on every push — a review runs only when a
# maintainer explicitly summons one by typing `@claude /review`:
# - in the PR's main conversation (issue_comment) → a full review of the PR;
# - as an inline review comment (pull_request_review_comment) → a "second set
# of eyes" pass that focuses on what the human review may have missed.
#
# Scoped so Claude can never write code from an invocation:
# - runs the code-review PLUGIN with a review prompt (analyze + post findings),
# not the general code-writing action;
# - no `contents: write`, so it cannot push commits;
# - fires ONLY on a maintainer's comment (author_association gate), so an
# outside contributor on a fork can never trigger it.
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
claude-review-on-demand:
# A MAINTAINER commented `@claude /review` — on a PR conversation, or inline
# on the diff. (issue_comment fires for issues too, so require a PR there.)
if: >-
contains(github.event.comment.body, '@claude /review') &&
(github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR') &&
(github.event_name == 'pull_request_review_comment' ||
github.event.issue.pull_request)
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
steps:
# Note: claude-code-action adds its own 👀 reaction to the triggering
# comment, so there's no explicit reaction step here.
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Prepare review context
id: prep
run: |
if [ "${{ github.event_name }}" = "issue_comment" ]; then
{
echo "pr=${{ github.event.issue.number }}"
echo "focus=Perform a thorough code review of this pull request."
} >> "$GITHUB_OUTPUT"
else
{
echo "pr=${{ github.event.pull_request.number }}"
echo "focus=Act as a second set of eyes on the review already in progress — prioritize anything the existing review comments may have missed, and keep it concise."
} >> "$GITHUB_OUTPUT"
fi
- name: Run Claude Code Review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# Single tracking comment (in-progress → results), updated in place.
track_progress: true
# The "Fix this →" claude.ai/code deep-links render as broken markdown
# (huge percent-encoded query). Turn them off at the source.
include_fix_links: false
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ steps.prep.outputs.pr }}
${{ steps.prep.outputs.focus }}
Review the diff for correctness, security, performance, test
adequacy, and clarity. Do NOT run the project's build/lint/test
locally, and do not fetch or report CI check status — CI runs those
and reports them on the PR itself; do not treat inability to run
tests yourself as a gap. Post concrete issues as inline comments on
the relevant lines, and a single top-level comment with the overall
assessment.
# In agent mode (comment-triggered) Claude only posts if it has these
# tools. All read-only or comment-posting — no local build/test, no CI reads.
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"