You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 38f13f4
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: .github/workflows/claude-review.yml
+12-8Lines changed: 12 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,10 @@ on:
32
32
description: The slug of the team, in the calling repository's owner organisation, whose members may request a review.
33
33
type: string
34
34
default: developers
35
+
app-client-id:
36
+
description: The client ID of the GitHub App, installed on the organisation with only "Members, read", that looks up team membership, usually `vars.CLAUDE_REVIEW_APP_CLIENT_ID`.
37
+
type: string
38
+
required: true
35
39
review-agent:
36
40
description: The login of the review agent, the account mentioned in a comment command or requested as a reviewer, whose pull requests are reviewed without a membership lookup and whose comments and reviewer requests never request a review.
37
41
type: string
@@ -40,11 +44,8 @@ on:
40
44
CLAUDE_ROUTINE_TOKEN:
41
45
description: The code-review routine's bearer token.
42
46
required: true
43
-
CLAUDE_REVIEW_APP_ID:
44
-
description: The id of the GitHub App, installed on the organisation with only "Members, read", that looks up team membership.
45
-
required: true
46
47
CLAUDE_REVIEW_APP_PRIVATE_KEY:
47
-
description: That GitHub App's private key.
48
+
description: The private key of the GitHub App named by `app-client-id`.
48
49
required: true
49
50
outputs:
50
51
# For a caller that checks what happened, such as this repository's self-test (.github/workflows/self-test.yml).
Copy file name to clipboardExpand all lines: README.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ It pins the reusable workflow to a full commit SHA, with the version in a commen
76
76
77
77
The example listens to `pull_request` (opened, reopened, ready for review and review requested) and `issue_comment` (created) events.
78
78
A caller copied before the requested reviewer kind existed needs `review_requested` added to its `pull_request` types.
79
-
Its workflow-level permissions are empty, and its calling job grants only `issues: write`, which the reaction needs: a reusable workflow's jobs can never hold more permissions than the job that calls them.
79
+
Its workflow-level permissions are empty, and its calling job grants only `issues: write` and `pull-requests: write`, which the reaction needs: a reusable workflow's jobs can never hold more permissions than the job that calls them.
80
80
Only the reusable workflow's `react` job uses that permission; its other jobs hold none.
81
81
The calling job also has an `if:` that starts the reusable workflow only for comments on pull requests that mention `@cipherstash-agent`, and for review requests for `cipherstash-agent`, to save starting runners for every other comment and request.
82
82
The reusable workflow still checks every rule itself.
@@ -96,9 +96,9 @@ The caller needs these settings, which CipherStash sets once for the whole organ
96
96
| Name | Kind | What it is |
97
97
| --- | --- | --- |
98
98
|`CLAUDE_ROUTINE_TOKEN`| secret | The code-review routine's bearer token. |
99
-
|`CLAUDE_REVIEW_APP_ID`| secret | The id of the membership GitHub App. |
100
99
|`CLAUDE_REVIEW_APP_PRIVATE_KEY`| secret | The membership GitHub App's private key. |
101
100
|`CLAUDE_ROUTINE_TRIGGER_ID`| variable | The routine's trigger id, which starts `trig_`. |
101
+
|`CLAUDE_REVIEW_APP_CLIENT_ID`| variable | The membership GitHub App's client ID, shown on the App's settings page. It is a variable, not a secret, because it is not secret and is passed as an input. |
102
102
103
103
The membership GitHub App is installed on the organisation with only the "Members: read" permission.
104
104
The workflow uses it to get a short-lived token and look up whether the requester (the pull request's author, the comment's author, or the person who requested the review agent as a reviewer) is in the team.
@@ -109,9 +109,10 @@ The workflow uses it to get a short-lived token and look up whether the requeste
109
109
| --- | --- | --- | --- |
110
110
|`routine-trigger-id`| yes || The routine's trigger id (`trig_…`). |
111
111
|`team`| no |`developers`| The slug of the team, in the calling repository's organisation, whose members may request a review. |
112
+
|`app-client-id`| yes || The membership GitHub App's client ID, usually `vars.CLAUDE_REVIEW_APP_CLIENT_ID`. |
112
113
|`review-agent`| no |`cipherstash-agent`| The login of the review agent. |
113
114
114
-
All three secrets, `CLAUDE_ROUTINE_TOKEN`, `CLAUDE_REVIEW_APP_ID` and `CLAUDE_REVIEW_APP_PRIVATE_KEY`, are required and must be passed explicitly, as the example does.
115
+
Both secrets, `CLAUDE_ROUTINE_TOKEN` and `CLAUDE_REVIEW_APP_PRIVATE_KEY`, are required and must be passed explicitly, as the example does.
115
116
116
117
The workflow has two outputs, for a caller that checks what happened, such as this repository's [self-test](#self-test):
117
118
@@ -135,7 +136,8 @@ A run has up to three jobs:
135
136
If the job could not check out its step file, no reaction is added, and the run shows a warning, but the check stays green. A failed checkout also prints its own error annotation, which is not a red check.
136
137
137
138
`decide` and `fire` hold no permissions.
138
-
`react` holds only `issues: write`, which GitHub documents as the permission for adding a reaction to an issue or pull request comment.
139
+
`react` holds only `issues: write` and `pull-requests: write`.
140
+
GitHub documents `issues: write` as the permission for adding a reaction to an issue or pull request comment, but on a pull request's comment it refused a token with only that (HTTP 403), so the job also holds `pull-requests: write`.
139
141
Only one `fire` runs per pull request at a time, whichever kind of review request started it: a second waits rather than cancelling the first. If a third arrives while the second is still waiting, GitHub's concurrency rules replace the second with it, and the replaced run sends nothing, and its `fire` job shows as cancelled. This is because the group uses `cancel-in-progress: false`, which keeps only one waiting run. The running one is never cancelled, and the newest request is the one that waits.
140
142
141
143
## The request decision
@@ -224,7 +226,7 @@ If the report's file was not checked out, the step still writes the `decision-fa
224
226
If the routine call's file was not checked out, the step sends nothing and shows an error.
225
227
If the reaction's file or the helper module was not checked out, or the helper module cannot be loaded, the step adds no reaction and shows a warning.
226
228
227
-
The `react` job holds only `issues: write`, and no `contents` permission, yet its checkout reads this repository with the job's token.
229
+
The `react` job holds only `issues: write` and `pull-requests: write`, and no `contents` permission, yet its checkout reads this repository with the job's token.
228
230
This relies on this repository being public, as for the `decide` and `fire` jobs, which hold no permissions at all; it is to be confirmed by the first live run (#20).
229
231
230
232
The routine API's address is fixed in `steps/fire.py`, so no input or event can change where the token goes.
@@ -294,7 +296,7 @@ The stub's reply is a comment on the pull request, as for the other kinds. It st
294
296
| --- | --- | --- |
295
297
|`CLAUDE_ROUTINE_INTEGRATION_TEST_TOKEN`| repository secret | The stub routine's bearer token. |
296
298
|`CLAUDE_ROUTINE_INTEGRATION_TEST_TRIGGER_ID`| repository variable | The stub routine's trigger id, which starts `trig_`. It must be a variable, because a secret cannot be passed as a reusable workflow's input. |
297
-
|`CLAUDE_REVIEW_APP_ID`, `CLAUDE_REVIEW_APP_PRIVATE_KEY`|secrets | The membership GitHub App, passed on with the same names. |
299
+
|`CLAUDE_REVIEW_APP_CLIENT_ID`, `CLAUDE_REVIEW_APP_PRIVATE_KEY`|variable and secret | The membership GitHub App, passed on as the `app-client-id` input and the secret of the same name. |
298
300
299
301
Pull requests here are usually opened by the review agent, `cipherstash-agent`, whose Ready requests need no membership check, so the test works without the App's secrets.
300
302
A pull request opened by anyone else needs the membership check.
0 commit comments