Skip to content

Commit 55c09bb

Browse files
authored
fix: codex pipeline — auto-trigger review and prevent duplicate PRs (#10)
* fix: expand codex-gate positive keywords to match Codex comment style * fix: codex pipeline — auto-trigger review and prevent duplicate PRs * fix: update codex-gate to use connector bot account and improve review prompt
1 parent dcbc216 commit 55c09bb

3 files changed

Lines changed: 60 additions & 3 deletions

File tree

.github/workflows/codex-gate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
github-token: ${{ secrets.GITHUB_TOKEN }}
2525
script: |
26-
const CODEX_USER = 'FuugaMo';
26+
const CODEX_USER = 'chatgpt-codex-connector';
2727
2828
// ── Resolve PR and commit SHA ──────────────────────────────────────
2929
let pr, sha;
@@ -68,7 +68,7 @@ jobs:
6868
// COMMENTED — parse the body for signals
6969
const body = (review.body || '').toLowerCase();
7070
const critical = ['critical', 'p0', 'security issue', 'breaking', 'incorrect'];
71-
const positive = ['lgtm', 'no issues', 'looks good', 'no critical', 'approved'];
71+
const positive = ['lgtm', 'no issues', 'looks good', 'no critical', 'approved', "didn't find any", 'no major issues', 'hooray'];
7272
if (critical.some(k => body.includes(k))) {
7373
state = 'failure';
7474
description = 'Codex flagged critical issues';
@@ -83,7 +83,7 @@ jobs:
8383
if (comment.user.login !== CODEX_USER) return;
8484
const body = (comment.body || '').toLowerCase();
8585
const critical = ['critical', 'p0', 'security issue', 'breaking', 'incorrect'];
86-
const positive = ['lgtm', 'no issues', 'looks good', 'no critical', 'approved'];
86+
const positive = ['lgtm', 'no issues', 'looks good', 'no critical', 'approved', "didn't find any", 'no major issues', 'hooray'];
8787
if (critical.some(k => body.includes(k))) {
8888
state = 'failure';
8989
description = 'Codex flagged critical issues';
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Trigger Codex Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, labeled]
6+
7+
jobs:
8+
trigger:
9+
if: contains(github.event.pull_request.labels.*.name, 'auto-fix')
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/github-script@v7
13+
with:
14+
github-token: ${{ secrets.FUUGAMO_PAT }}
15+
script: |
16+
await github.rest.issues.createComment({
17+
owner: context.repo.owner,
18+
repo: context.repo.repo,
19+
issue_number: context.payload.pull_request.number,
20+
body: '@codex Please review this PR. If you find no critical issues, reply with "LGTM". If you find critical issues, describe them clearly.',
21+
});
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Label Issue When PR Opened
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened]
6+
7+
permissions:
8+
issues: write
9+
pull-requests: read
10+
11+
jobs:
12+
label-issue:
13+
if: contains(github.event.pull_request.labels.*.name, 'auto-fix')
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/github-script@v7
17+
with:
18+
github-token: ${{ secrets.GITHUB_TOKEN }}
19+
script: |
20+
const body = context.payload.pull_request.body || '';
21+
const matches = body.match(/(?:closes?|fixes?|resolves?)\s+#(\d+)/gi) || [];
22+
const issueNumbers = matches.map(m => parseInt(m.match(/#(\d+)/)[1]));
23+
24+
for (const num of issueNumbers) {
25+
try {
26+
await github.rest.issues.addLabels({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
issue_number: num,
30+
labels: ['has-pr'],
31+
});
32+
console.log(`Labeled issue #${num} with has-pr`);
33+
} catch (e) {
34+
console.warn(`Could not label issue #${num}: ${e.message}`);
35+
}
36+
}

0 commit comments

Comments
 (0)