OpenAI PR review #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: OpenAI PR review | |
| on: | |
| workflow_run: | |
| workflows: [OpenAI PR review request] | |
| types: [completed] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| pull-request: | |
| if: >- | |
| github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.conclusion == 'success' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| eligible: ${{ steps.pr.outputs.eligible }} | |
| number: ${{ steps.pr.outputs.number }} | |
| base_sha: ${{ steps.pr.outputs.base_sha }} | |
| head_sha: ${{ steps.pr.outputs.head_sha }} | |
| steps: | |
| - name: Resolve pull request from unprivileged signal | |
| id: pr | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| script: | | |
| const [signaledPullRequest] = context.payload.workflow_run.pull_requests; | |
| if (!signaledPullRequest) { | |
| core.setOutput('eligible', 'false'); | |
| return; | |
| } | |
| const { data: pullRequest } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: signaledPullRequest.number, | |
| }); | |
| const eligible = pullRequest.state === 'open' && | |
| !pullRequest.draft && | |
| pullRequest.head.repo?.fork === false; | |
| core.setOutput('eligible', String(eligible)); | |
| core.setOutput('number', String(pullRequest.number)); | |
| core.setOutput('base_sha', pullRequest.base.sha); | |
| core.setOutput('head_sha', pullRequest.head.sha); | |
| review: | |
| needs: pull-request | |
| if: needs.pull-request.outputs.eligible == 'true' | |
| uses: ./.github/workflows/codex-openai-review.yml | |
| with: | |
| model: gpt-5.6-terra | |
| effort: medium | |
| review-instructions: >- | |
| Review only the pull-request diff and report actionable findings. | |
| pull_request_number: ${{ needs.pull-request.outputs.number }} | |
| base_sha: ${{ needs.pull-request.outputs.base_sha }} | |
| head_sha: ${{ needs.pull-request.outputs.head_sha }} | |
| secrets: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |