Commit e9140e7
Post issue-bot PR comment from a workflow_run workflow
The "Issue bot" workflow runs on the pull_request event, whose GITHUB_TOKEN is
read-only and secret-less for PRs from forks — so its comment-posting step got a
403 "Resource not accessible by integration" on fork PRs.
Move all PR-comment posting into a new issue-bot-pr-comment.yml triggered by
workflow_run, which runs in the base-repo context with a writable token and
secrets, so it can comment on fork PRs too. It only consumes the pr-comment
artifact (body + exit-code marker) produced by the analysis run; it never checks
out or runs PR code, and it resolves the PR number from the trusted head SHA
(workflow_run.pull_requests is empty for forks). Posting uses PHPSTAN_BOT_TOKEN
so the comment comes from the bot account.
issue-bot.yml no longer needs pull-requests: write; the pr-comment-init and
pr-comment-finalize jobs are removed and the exit code now travels in the
artifact as a marker file.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a7d4f61 commit e9140e7
2 files changed
Lines changed: 105 additions & 83 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 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 | | - | |
59 | | - | |
60 | | - | |
61 | 28 | | |
62 | 29 | | |
63 | 30 | | |
| |||
197 | 164 | | |
198 | 165 | | |
199 | 166 | | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | 167 | | |
204 | 168 | | |
205 | 169 | | |
| |||
240 | 204 | | |
241 | 205 | | |
242 | 206 | | |
243 | | - | |
244 | 207 | | |
245 | 208 | | |
246 | 209 | | |
| |||
265 | 228 | | |
266 | 229 | | |
267 | 230 | | |
268 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
269 | 235 | | |
270 | 236 | | |
271 | 237 | | |
272 | 238 | | |
273 | 239 | | |
274 | | - | |
| 240 | + | |
275 | 241 | | |
276 | 242 | | |
277 | 243 | | |
| |||
286 | 252 | | |
287 | 253 | | |
288 | 254 | | |
289 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
290 | 258 | | |
291 | 259 | | |
292 | 260 | | |
| |||
306 | 274 | | |
307 | 275 | | |
308 | 276 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
0 commit comments