feat(ci): show the AI review among the PR's checks

Comment-triggered runs belong to main, so GitHub never lists them in the
PR's checks and the only sign of a running review is a reaction on the
comment. Set an informational "AI PR Review" commit status on the PR
head, linking to the run: pending when the gate accepts, then success or
error. A run cancelled by a newer review of the same commit leaves the
newer run's status alone.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Ramon Roche committed 2026-10-02 19:38:09 -07:00
1 parent 1ca4506927
commit a9a86dad76
5 files changed
+135 -15

No files matched your search

+16 -5
View File
@@ -13,7 +13,9 @@ name: AI PR Review
# pr-review-poster.yml (never approve or request changes), replacing the
# previous one from this workflow; the full report also goes to the job
# summary and the ai-review-report artifact. The triggering comment gets
# 👀 when accepted, then 🚀 or 😕 when the review finishes.
# 👀 when accepted, then 🚀 or 😕 when the review finishes. The PR head
# also gets an "AI PR Review" commit status linking to the run, so the
# review shows among the PR's checks (informational, never required).
#
# Credentials: the review job assumes the px4-ai-review IAM role through
# GitHub OIDC. That role's trust policy only accepts this file running
@@ -65,9 +67,11 @@ jobs:
# reacting to a comment on a pull request needs pull-requests, not
# issues, permission
pull-requests: write
statuses: write # "AI PR Review" status on the PR head
outputs:
run: ${{ steps.decide.outputs.run }}
pr: ${{ steps.decide.outputs.pr }}
head_sha: ${{ steps.decide.outputs.head_sha }}
model: ${{ steps.decide.outputs.model }}
effort: ${{ steps.decide.outputs.effort }}
comment_id: ${{ steps.decide.outputs.comment_id }}
@@ -197,16 +201,15 @@ jobs:
retention-days: 30
finish:
name: Report back on the comment
name: Report back on the PR
needs: [gate, review]
if: >-
always() && needs.gate.outputs.run == 'true'
&& needs.gate.outputs.comment_id != '0'
if: always() && needs.gate.outputs.run == 'true'
runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}"]
timeout-minutes: 5
permissions:
contents: read
pull-requests: write # react to the triggering comment
statuses: write # final "AI PR Review" status on the PR head
steps:
- uses: runs-on/action@v2
- name: Checkout review tooling
@@ -214,7 +217,15 @@ jobs:
with:
persist-credentials: false
sparse-checkout: Tools/ci
- name: Status
working-directory: Tools/ci
env:
GITHUB_TOKEN: ${{ github.token }}
HEAD_SHA: ${{ needs.gate.outputs.head_sha }}
RESULT: ${{ needs.review.result }}
run: python3 -m ai_review status "$HEAD_SHA" "$RESULT"
- name: React
if: needs.gate.outputs.comment_id != '0'
working-directory: Tools/ci
env:
GITHUB_TOKEN: ${{ github.token }}