-
Notifications
You must be signed in to change notification settings - Fork 683
80 lines (69 loc) · 2.49 KB
/
codex-review.yml
File metadata and controls
80 lines (69 loc) · 2.49 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
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
name: Codex Review
on:
pull_request_target:
types: [opened, labeled, reopened, ready_for_review]
paths-ignore:
- '**.md'
- '**.rst'
- 'LICENSE.txt'
- 'doc/**/*.txt'
- '**/AUTHORS'
- '**/SPONSORS'
- '**/TIPS'
jobs:
codex-review:
if: github.event.pull_request.draft == false || (github.event.action == 'labeled' && contains(github.event.pull_request.labels.*.name, 'codex'))
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
final_message: ${{ steps.run_codex.outputs.final-message }}
steps:
- name: Check out PR merge commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Fetch base and head refs
run: |
git fetch --no-tags origin \
${{ github.event.pull_request.base.ref }} \
+refs/pull/${{ github.event.pull_request.number }}/head
- name: Run Codex review
id: run_codex
uses: openai/codex-action@v1
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
prompt: |
You are reviewing PR #${{ github.event.pull_request.number }} for ${{ github.repository }}.
Only review changes introduced by this PR:
git log --oneline ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}
Focus on:
- correctness bugs and regressions
- security concerns
- missing tests or edge cases
Keep feedback concise and actionable.
Pull request title and body:
----
${{ github.event.pull_request.title }}
${{ github.event.pull_request.body }}
post-feedback:
runs-on: ubuntu-latest
needs: codex-review
if: needs.codex-review.outputs.final_message != ''
permissions:
issues: write
pull-requests: write
steps:
- name: Post Codex review as PR comment
uses: actions/github-script@v8
env:
CODEX_FINAL_MESSAGE: ${{ needs.codex-review.outputs.final_message }}
with:
github-token: ${{ github.token }}
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: process.env.CODEX_FINAL_MESSAGE,
});