Skip to content

Commit e5a2fd8

Browse files
committed
fix: limita le invocazioni Codex fidate
1 parent db38c1c commit e5a2fd8

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/codex-review-gate.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ jobs:
2828
if: >-
2929
github.event_name != 'issue_comment' ||
3030
(github.event.issue.pull_request &&
31-
github.event.comment.user.type != 'Bot' &&
32-
contains(github.event.comment.body, '@codex review'))
31+
github.event.comment.body == '@codex review' &&
32+
(github.event.comment.author_association == 'OWNER' ||
33+
github.event.comment.author_association == 'MEMBER' ||
34+
github.event.comment.author_association == 'COLLABORATOR'))
3335
runs-on: ubuntu-latest
3436
timeout-minutes: 310
3537
steps:

scripts/codex-review-gate.test.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ test("seleziona solo un'invocazione esatta, fidata e successiva all'HEAD", () =>
113113
id: 1,
114114
user: { login: "max23468" },
115115
author_association: "OWNER",
116+
body: "@codex review",
117+
created_at: "2026-08-09T11:59:59Z",
118+
},
119+
{
120+
id: 4,
121+
user: { login: "max23468" },
122+
author_association: "OWNER",
116123
body: "non eseguire @codex review",
117124
created_at: "2026-08-09T12:00:01Z",
118125
},
@@ -169,6 +176,9 @@ test("il workflow usa codice trusted e non richiede commenti al primo giro", asy
169176
);
170177
assert.match(workflow, /pull_request_target:/);
171178
assert.match(workflow, /issue_comment:/);
179+
assert.match(workflow, /github\.event\.comment\.body == '@codex review'/);
180+
assert.match(workflow, /github\.event\.comment\.author_association == 'OWNER'/);
181+
assert.doesNotMatch(workflow, /contains\(github\.event\.comment\.body/);
172182
assert.match(workflow, /statuses: write/);
173183
assert.doesNotMatch(workflow, /issues: write/);
174184
assert.match(workflow, /node --test scripts\/codex-review-gate\.test\.mjs/);

0 commit comments

Comments
 (0)