repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

.github/workflows/adw-codex-review.yml

Raw
File outline
# Codex cross-family review โ€” a second opinion from a different model family,
# advisory (never a gate label; a Codex outage can't wedge a merge).
#
# Runs autonomously on every non-draft PR. The repo is members-only (issues and
# PRs only from repository members), so there is no untrusted external author โ€”
# the credentialed-agent-over-untrusted-input problem is gone at the source, and
# no author gate or approval is needed. Fork PRs get no secrets anyway.
name: adw-codex-review

on:
  pull_request:
    types: [opened, synchronize, reopened]

permissions:
  contents: read
  pull-requests: write

concurrency:
  group: adw-codex-review-${{ github.event.pull_request.number }}
  cancel-in-progress: true

jobs:
  codex:
    if: >-
      github.event.pull_request.draft == false &&
      github.event.pull_request.user.login != 'dependabot[bot]'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - name: Codex auth
        env:
          CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}
        run: |
          mkdir -p ~/.codex
          printf '%s' "$CODEX_AUTH_JSON" > ~/.codex/auth.json
          chmod 600 ~/.codex/auth.json
      - run: npm install -g @openai/codex
      - name: Review (advisory, fail-open)
        continue-on-error: true
        env:
          GH_TOKEN: ${{ github.token }}
          PR: ${{ github.event.pull_request.number }}
          REPO: ${{ github.repository }}
        run: |
          gh pr diff "$PR" --repo "$REPO" | head -c 100000 > pr.diff
          codex exec --sandbox read-only "Cross-family review of this PR diff (read AGENTS.md for repo rules). Be terse: real, file-anchored findings only, most severe first, one line each. No preamble, no praise, no restating the diff. If nothing material, reply exactly 'No blocking findings.' Diff:
          $(cat pr.diff)" > review.md 2> codex.err || true
          # codex prints its banner/progress to stderr; keep it out of the comment.
          grep -q '[^[:space:]]' review.md || echo "_Codex unavailable (advisory)._" > review.md
          { echo "๐Ÿ”Ž **Codex** (advisory cross-family review)"; echo;
            sed -E 's#(gh[pousr]_[A-Za-z0-9]{20,}|sk-[A-Za-z0-9_-]{20,}|eyJ[A-Za-z0-9._-]{20,})#***#g' review.md; } > c.md
          gh pr comment "$PR" --repo "$REPO" --body-file c.md || true
          gh pr edit "$PR" --repo "$REPO" --add-label codex-reviewed || true