Skip to content

Adopt new brand slogans (where video becomes citable / stop scrubbing) #374

Adopt new brand slogans (where video becomes citable / stop scrubbing)

Adopt new brand slogans (where video becomes citable / stop scrubbing) #374

name: Auto Codex Review on PR
on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
codex-review:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && github.actor != 'dependabot[bot]'
steps:
- name: Request Codex review
uses: actions/github-script@v9
with:
github-token: ${{ secrets.CODEX_PAT }}
script: |
const pullRequest = context.payload.pull_request;
const prNumber = pullRequest.number;
const event = context.payload.action;
const headSha = pullRequest.head.sha;
const requestBody = [
'@codex review plz',
'',
`Event: ${event}`,
`Commit: ${headSha}`
].join('\n');
// Detect the PAT owner's login so dedup works regardless of which account owns the token
const { data: tokenUser } = await github.rest.users.getAuthenticated();
const botLogin = tokenUser.login;
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
per_page: 100
});
const alreadyRequestedForCommit = comments.data.some(
c =>
c.user.login === botLogin &&
c.body.includes('@codex review plz') &&
c.body.includes(`Commit: ${headSha}`)
);
if (alreadyRequestedForCommit) {
console.log(`Codex review already requested for commit ${headSha}, skipping`);
return;
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: requestBody
});
console.log(`Requested Codex review on PR #${prNumber} for commit ${headSha}`);