Commit cfd4ce9
committed
Fix /review trigger: gate JSON parse + reaction permission scope
Two independent bugs prevented the PR review workflow from running on /review comments:
1. gate.py used gh_json() to fetch the commenter's permission level, but
'gh api ... -q .permission' returns a bare token (e.g. 'admin'), not
JSON. json.loads() raised JSONDecodeError, which was swallowed by the
broad except and treated as 'no write access'. Every commenter,
including admins, was rejected. Switched to gh() and compare the raw
stdout instead.
2. The dispatch job declared 'issues: write' + 'pull-requests: read', but
POSTing a reaction to a PR-issue comment requires 'pull-requests:
write' on the GITHUB_TOKEN (the URL is /issues/comments/.../reactions,
but the resource is a PR comment). The 'React eyes' step returned
HTTP 403 'Resource not accessible by integration'. Swapped the
scopes.1 parent ccd1942 commit cfd4ce9
3 files changed
Lines changed: 10 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
80 | | - | |
81 | | - | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
| 74 | + | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
0 commit comments