Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/codex-after-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Codex review (after CI success)

# Posts @codex review comment after successful CI on PRs.
# Uses workflow_run to trigger after the main CI workflow completes.
# File must live on the default branch to trigger (GitHub Actions limitation).
#
# REQUIRES: Repository secret 'CODEX_COMMENT_TOKEN' (PAT with):
# - Permissions: pull_requests: write (to post comments as a user)
# - Scopes: repo (private) or public_repo (public)
# Without PAT, comments come from github-actions[bot] and Copilot may not respond.

on:
workflow_run:
workflows: ["accparser CI"] # Trigger after the main CI workflow
types: [completed]

permissions:
contents: read
issues: write
pull-requests: write

jobs:
comment:
# Only run when CI succeeded and was triggered by a PR
if: >
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Debug workflow run info
run: |
echo "Workflow conclusion: ${{ github.event.workflow_run.conclusion }}"
echo "Workflow event: ${{ github.event.workflow_run.event }}"
echo "Workflow name: ${{ github.event.workflow_run.name }}"
echo "Pull requests: ${{ toJson(github.event.workflow_run.pull_requests) }}"

- name: Get PR number
id: pr
run: |
prs='${{ toJson(github.event.workflow_run.pull_requests) }}'
echo "PRs JSON: $prs"

if echo "$prs" | jq -e 'length == 0' >/dev/null || [ -z "$prs" ]; then
echo "No PR found for this workflow run"
echo "pr=" >> "$GITHUB_OUTPUT"
exit 0
fi

pr_number=$(echo "$prs" | jq -r '.[0].number')
echo "Found PR number: $pr_number"
echo "pr=$pr_number" >> "$GITHUB_OUTPUT"

- name: Post @codex review comment
if: steps.pr.outputs.pr != ''
env:
GH_TOKEN: ${{ secrets.CODEX_COMMENT_TOKEN }}
run: |
echo "Posting @codex review comment to PR #${{ steps.pr.outputs.pr }}"
gh pr comment ${{ steps.pr.outputs.pr }} \
--repo ${{ github.repository }} \
--body "@codex review"
echo "✓ Posted @codex review comment"