Skip to content

πŸ”§ chore(repo): drop local editor config #15

πŸ”§ chore(repo): drop local editor config

πŸ”§ chore(repo): drop local editor config #15

Workflow file for this run

name: Code Review
on:
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
workflow_call:
# Reusable callers must pass PR context explicitly because `github.event.pull_request`
# is not populated for `workflow_call` runs.
inputs:
pr_number:
description: Pull request number to review when called as a reusable workflow.
required: true
type: number
is_draft:
description: Whether the pull request is still a draft when called as a reusable workflow.
required: false
default: false
type: boolean
head_repo_full_name:
description: Head repository full name for same-repo validation.
required: false
type: string
secrets:
ANTHROPIC_API_KEY:
required: true
permissions:
# `actions: read` keeps Actions metadata readable for the running job.
actions: read
# `contents: read` is required for checkout and for Claude to inspect repository files.
contents: read
# `id-token: write` is required because `claude-code-action` requests an OIDC token internally.
id-token: write
# `pull-requests: write` is required to request the Copilot reviewer and post inline review comments.
pull-requests: write
concurrency:
# Use the PR number when available so repeated reviews for the same PR cancel older runs
# whether this workflow is triggered directly or via `workflow_call`.
group: claude-review-${{ github.repository }}-${{ github.event.pull_request.number || inputs.pr_number || github.run_id }}
cancel-in-progress: true
jobs:
review:
if: >-
(
github.event_name == 'pull_request' &&
github.event.pull_request &&
!github.event.pull_request.draft &&
github.event.pull_request.head.repo.full_name == github.repository
) || (
github.event_name == 'workflow_call' &&
inputs.pr_number &&
!inputs.is_draft &&
(
!inputs.head_repo_full_name ||
inputs.head_repo_full_name == github.repository
)
)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Request Copilot review
# Copilot review is optional. Keep Claude review running if this request is unavailable.
continue-on-error: true
run: |
gh pr edit "$PR_NUMBER" -R "$REPO" --add-reviewer @copilot
env:
GH_TOKEN: ${{ github.token }}
# Support both direct PR-triggered runs and reusable workflow callers.
PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }}
REPO: ${{ github.repository }}
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
# Keep enough history for `git log` and `git blame` without cloning everything.
fetch-depth: 100
- uses: anthropics/claude-code-action@e69ec4d5e5868930cecb8da7360a51fa9c4de5d6 # v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
Review this pull request for code quality, correctness, and security.
Analyze the diff in the context of the full codebase.
Only report actionable findings that are specific and important.
Use these severity levels in each finding: P1 for blocking or high-risk issues, P2 for meaningful issues, P3 for minor issues.
Skip generated files, lockfiles, vendored code, and style-only nits unless they hide a real bug.
Keep the review concise: at most 10 findings total.
Post findings as inline review comments on the specific lines where issues are found.
Follow the guidelines in REVIEW.md if present.
# Keep the tool surface narrow: inline comments plus read-only PR inspection.
claude_args: |
--model opus
--max-turns 30
--allowedTools "Read,Glob,Grep,mcp__github_inline_comment__create_inline_comment,Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr checks:*),Bash(git log:*),Bash(git blame:*),Bash(git diff:*)"
env:
GH_TOKEN: ${{ github.token }}
ANTHROPIC_BASE_URL: ${{ vars.ANTHROPIC_BASE_URL || 'https://api.anthropic.com' }}