Repository navigation
Expand file tree
/
Copy pathclaude-review.yml
More file actions
58 lines (55 loc) · 3.54 KB
/
Copy pathclaude-review.yml
File metadata and controls
58 lines (55 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Asks Claude for a code review of a pull request, using the shared workflow in cipherstash/workflows. Copy this file
# to .github/workflows/claude-review.yml in a repository to add the review there.
#
# Reviews a non-draft pull request when it is opened or reopened, or when a draft is marked ready for review, if its
# author is a member of the @cipherstash/developers team. A team member can also ask for a review, on drafts too, by
# commenting on a pull request with a first line starting `@cipherstash-agent review`; the rest of the comment is passed
# on as instructions, and the comment gets a 👀 reaction once the request is sent. A team member can also request a
# review from cipherstash-agent in a pull request's Reviewers box, on drafts too. The rules live in the shared
# workflow, pinned below by commit.
#
# Comments run this file from the default branch, so the comment command works only once this file is merged there.
#
# Needs, as organisation or repository settings:
# secret CLAUDE_ROUTINE_TOKEN the code-review routine's bearer token
# secret CLAUDE_REVIEW_APP_PRIVATE_KEY the membership GitHub App's private key
# variable CLAUDE_ROUTINE_TRIGGER_ID the routine's trigger id (`trig_…`)
# variable CLAUDE_REVIEW_APP_CLIENT_ID the membership GitHub App's client ID (`Iv…`)
name: Claude review
on:
pull_request:
types: [opened, reopened, ready_for_review, review_requested]
# zizmor flags issue_comment because anyone who can comment can start this workflow. Accepted: the shared
# workflow acts only on a comment command from a team member, checked by its decide job, and never runs code from
# the pull request.
issue_comment: # zizmor: ignore[dangerous-triggers] only a team member's comment command is acted on
types: [created]
permissions: {}
jobs:
review:
# Saves starting runners for comments that cannot be a comment command: only comments on pull requests that mention
# the review agent (contains ignores case) go on. The shared workflow still checks every rule itself.
# The mention must match the shared workflow's `review-agent` input: change it here too if you change that input.
# There is no filter on the commenter's author_association: GitHub reports a team member whose organisation
# membership is private as CONTRIBUTOR or NONE, so such a filter would silently skip their commands. The shared
# workflow's team membership check is the gate, and the mention is the only filter on comments.
# A review request for any reviewer other than the review agent does not start the workflow. Other pull_request
# events are not filtered.
if: >-
(github.event_name != 'issue_comment' || (
github.event.issue.pull_request
&& contains(github.event.comment.body, '@cipherstash-agent')
))
&& (github.event.action != 'review_requested' || github.event.requested_reviewer.login == 'cipherstash-agent')
# The shared workflow's jobs can hold no more than this. Only its reaction job uses it, to add 👀 to a comment
# command; its other jobs hold no permissions.
permissions:
issues: write
pull-requests: write
uses: cipherstash/workflows/.github/workflows/claude-review.yml@07d2f90959fcaf9d4fe64d1e9b50fe9b2a9bbac0 # feat/requested-reviewer (pre-release)
with:
routine-trigger-id: ${{ vars.CLAUDE_ROUTINE_TRIGGER_ID }}
app-client-id: ${{ vars.CLAUDE_REVIEW_APP_CLIENT_ID }}
secrets:
CLAUDE_ROUTINE_TOKEN: ${{ secrets.CLAUDE_ROUTINE_TOKEN }}
CLAUDE_REVIEW_APP_PRIVATE_KEY: ${{ secrets.CLAUDE_REVIEW_APP_PRIVATE_KEY }}