|
32 | 32 | head_sha: ${{ steps.pr.outputs.head_sha }} |
33 | 33 | request_comment_id: ${{ steps.pr.outputs.request_comment_id }} |
34 | 34 | review_focus: ${{ steps.pr.outputs.review_focus }} |
| 35 | + review: ${{ steps.codex.outputs.final-message }} |
| 36 | + env: |
| 37 | + PULL_REQUEST_NUMBER: ${{ steps.pr.outputs.number }} |
| 38 | + PR_BASE_SHA: ${{ steps.pr.outputs.base_sha }} |
| 39 | + PR_HEAD_SHA: ${{ steps.pr.outputs.head_sha }} |
| 40 | + REQUEST_COMMENT_ID: ${{ steps.pr.outputs.request_comment_id }} |
35 | 41 | steps: |
36 | 42 | - name: Authorize explicit review request |
37 | 43 | id: pr |
|
84 | 90 | core.setOutput('base_sha', pullRequest.base.sha); |
85 | 91 | core.setOutput('head_sha', pullRequest.head.sha); |
86 | 92 |
|
| 93 | + - name: Check out trusted pull-request base commit |
| 94 | + if: steps.pr.outputs.eligible == 'true' |
| 95 | + uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 |
| 96 | + with: |
| 97 | + ref: ${{ steps.pr.outputs.base_sha }} |
| 98 | + persist-credentials: false |
| 99 | + |
| 100 | + - name: Mark manual request in progress |
| 101 | + id: request_reaction |
| 102 | + if: steps.pr.outputs.eligible == 'true' && env.REQUEST_COMMENT_ID != '' |
| 103 | + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 |
| 104 | + with: |
| 105 | + script: | |
| 106 | + const { data: reaction } = await github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: Number(process.env.REQUEST_COMMENT_ID), content: 'eyes' }); |
| 107 | + core.setOutput('reaction_id', String(reaction.id)); |
| 108 | +
|
| 109 | + - name: Review pull request with OpenAI |
| 110 | + id: codex |
| 111 | + if: steps.pr.outputs.eligible == 'true' |
| 112 | + uses: openai/codex-action@52fe01ec70a42f454c9d2ebd47598f9fd6893d56 # v1 |
| 113 | + with: |
| 114 | + openai-api-key: ${{ secrets.OPENAI_API_KEY }} |
| 115 | + model: gpt-5.6-terra |
| 116 | + effort: medium |
| 117 | + sandbox: read-only |
| 118 | + safety-strategy: drop-sudo |
| 119 | + prompt: Review this pull request using its diff. Return a concise review. |
| 120 | + |
| 121 | + - name: Record manual request result |
| 122 | + if: always() && steps.pr.outputs.request_comment_id != '' |
| 123 | + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 |
| 124 | + env: |
| 125 | + REQUEST_REACTION_ID: ${{ steps.request_reaction.outputs.reaction_id }} |
| 126 | + REVIEW_OUTCOME: ${{ steps.codex.outcome }} |
| 127 | + with: |
| 128 | + script: | |
| 129 | + const commentId = Number(process.env.REQUEST_COMMENT_ID); const reactionId = Number(process.env.REQUEST_REACTION_ID); |
| 130 | + if (reactionId) await github.request('DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}', { owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, reaction_id: reactionId }); |
| 131 | + await github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: commentId, content: process.env.REVIEW_OUTCOME === 'success' ? 'rocket' : process.env.REVIEW_OUTCOME === 'cancelled' ? 'confused' : '-1' }); |
| 132 | +
|
87 | 133 | review: |
88 | 134 | needs: pull-request |
89 | | - if: needs.pull-request.outputs.eligible == 'true' |
| 135 | + if: false |
90 | 136 | runs-on: ubuntu-latest |
91 | 137 | permissions: |
92 | 138 | contents: read |
@@ -207,14 +253,14 @@ jobs: |
207 | 253 | }); |
208 | 254 |
|
209 | 255 | publish: |
210 | | - needs: [pull-request, review] |
211 | | - if: needs.review.result == 'success' |
| 256 | + needs: [pull-request] |
| 257 | + if: false |
212 | 258 | runs-on: ubuntu-latest |
213 | 259 | permissions: |
214 | 260 | contents: read |
215 | 261 | pull-requests: write |
216 | 262 | env: |
217 | | - REVIEW: ${{ needs.review.outputs.review }} |
| 263 | + REVIEW: ${{ needs.pull-request.outputs.review }} |
218 | 264 | PULL_REQUEST_NUMBER: ${{ needs.pull-request.outputs.number }} |
219 | 265 | PR_HEAD_SHA: ${{ needs.pull-request.outputs.head_sha }} |
220 | 266 | steps: |
|
0 commit comments