Skip to content

Commit a4b4bc5

Browse files
committed
ci: add codex PR review workflow
1 parent 4c3b2fe commit a4b4bc5

2 files changed

Lines changed: 78 additions & 0 deletions

File tree

.github/workflows/codex-review.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Codex Review
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened, synchronize, ready_for_review]
6+
7+
jobs:
8+
codex-review:
9+
if: github.event.pull_request.draft == false
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
outputs:
14+
final_message: ${{ steps.run_codex.outputs.final-message }}
15+
16+
steps:
17+
- name: Check out PR merge commit
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
19+
with:
20+
ref: refs/pull/${{ github.event.pull_request.number }}/merge
21+
22+
- name: Fetch base and head refs
23+
run: |
24+
git fetch --no-tags origin \
25+
${{ github.event.pull_request.base.ref }} \
26+
+refs/pull/${{ github.event.pull_request.number }}/head
27+
28+
- name: Run Codex review
29+
id: run_codex
30+
uses: openai/codex-action@v1
31+
with:
32+
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
33+
prompt: |
34+
You are reviewing PR #${{ github.event.pull_request.number }} for ${{ github.repository }}.
35+
36+
Only review changes introduced by this PR:
37+
git log --oneline ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}
38+
39+
Focus on:
40+
- correctness bugs and regressions
41+
- security concerns
42+
- missing tests or edge cases
43+
44+
Keep feedback concise and actionable.
45+
46+
Pull request title and body:
47+
----
48+
${{ github.event.pull_request.title }}
49+
${{ github.event.pull_request.body }}
50+
51+
post-feedback:
52+
runs-on: ubuntu-latest
53+
needs: codex-review
54+
if: needs.codex-review.outputs.final_message != ''
55+
permissions:
56+
issues: write
57+
pull-requests: write
58+
59+
steps:
60+
- name: Post Codex review as PR comment
61+
uses: actions/github-script@v7
62+
env:
63+
CODEX_FINAL_MESSAGE: ${{ needs.codex-review.outputs.final_message }}
64+
with:
65+
github-token: ${{ github.token }}
66+
script: |
67+
await github.rest.issues.createComment({
68+
owner: context.repo.owner,
69+
repo: context.repo.repo,
70+
issue_number: context.payload.pull_request.number,
71+
body: process.env.CODEX_FINAL_MESSAGE,
72+
});

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Unreleased
2+
3+
### Internal
4+
5+
- Add a GitHub Actions workflow to run Codex review on pull requests.
6+
17
## 1.19.0 - 2026-01-30
28

39
### Features

0 commit comments

Comments
 (0)