fix: add ~75s grace period for Codex review CI check #134
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: PR | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: ["**"] | |
| merge_group: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| check: | |
| name: Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - run: npm ci | |
| - run: npm run check | |
| test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - run: npm ci | |
| - run: npm run test | |
| smoke: | |
| name: Smoke Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - run: npm ci | |
| - run: npm run smoke | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - run: npm ci | |
| - run: npm run vite:build | |
| cargo-check: | |
| name: Cargo Check (${{ matrix.platform }}) | |
| strategy: | |
| matrix: | |
| platform: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "src-tauri -> target" | |
| - name: Install Linux dependencies | |
| if: matrix.platform == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libwebkit2gtk-4.1-dev \ | |
| libayatana-appindicator3-dev \ | |
| librsvg2-dev | |
| - run: cargo check | |
| working-directory: src-tauri | |
| codex-review: | |
| name: Codex Review | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Check for open Codex reviews | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| set -uo pipefail | |
| # Grace period: retry up to ~75s when Codex hasn't responded yet. | |
| max_attempts=6 | |
| interval=15 | |
| attempt=0 | |
| while true; do | |
| attempt=$((attempt + 1)) | |
| if ./scripts/check_codex_comments.sh "$PR_NUMBER"; then | |
| rc=0 | |
| else | |
| rc=$? | |
| fi | |
| case "$rc" in | |
| 0) | |
| echo "✅ Codex review approved" | |
| exit 0 | |
| ;; | |
| 10) | |
| if [ "$attempt" -ge "$max_attempts" ]; then | |
| echo "⏳ Codex review not yet received after ${attempt} attempts — request one with: @codex review" | |
| exit 1 | |
| fi | |
| echo "⏳ No Codex response yet (attempt ${attempt}/${max_attempts}), retrying in ${interval}s..." | |
| sleep "$interval" | |
| ;; | |
| *) | |
| echo "❌ Codex review has comments to address" | |
| exit 1 | |
| ;; | |
| esac | |
| done |