-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (33 loc) · 1.34 KB
/
codex-trigger.yml
File metadata and controls
38 lines (33 loc) · 1.34 KB
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
name: Trigger Codex Review
on:
pull_request:
types: [opened, reopened, labeled, synchronize]
jobs:
trigger:
if: contains(github.event.pull_request.labels.*.name, 'auto-fix')
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.FUUGAMO_PAT }}
script: |
const prNumber = context.payload.pull_request.number;
const pingText = '@codex Please review this PR. If you find no critical issues, reply with "LGTM". If you find critical issues, describe them clearly.';
// 去重:如果已存在相同触发评论则跳过,避免重复@codex
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
per_page: 100,
});
const alreadyPinged = comments.some(c => (c.body || '').includes(pingText));
if (alreadyPinged) {
core.info('Codex already pinged on this PR, skip duplicate comment.');
return;
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: pingText,
});