Publish weighted approval as a completed check run

Unmet weighted approval conditions previously left a pending commit
status that CI watchers treat as running work, so gh pr checks --watch
and similar monitors never finished. Publish the decision as the
weighted approval decision check run instead: action_required blocks
merging while completing the check, and failure reports evaluation
errors.
This commit is contained in:
turtle1999 committed 2026-09-29 12:48:04 +08:00
1 parent 31ed8ec4c4
commit 094a8701fe
20 files changed
+293 -218

No files matched your search

+7 -7
View File
@@ -10,9 +10,9 @@ on:
types: [completed]
permissions:
checks: write
contents: read
pull-requests: write
statuses: write
concurrency:
group: weighted-approval-${{ (github.event.pull_request.number || github.event.issue.number) && format('weighted-approval-review-event:{0}', github.event.pull_request.number || github.event.issue.number) || github.event.workflow_run.display_title }}
@@ -29,20 +29,20 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# SECURITY: the status-writing job executes policy from the trusted default
# SECURITY: the check-writing job executes policy from the trusted default
# branch and reads pull-request reviews and comments only as API data.
- name: Check out trusted approval policy
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
- name: Revoke previous approval status
- name: Revoke previous approval decision
id: revoke
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: node .github/review-ownership/check-approval.mjs pending
# SECURITY: dependency setup runs in the status-writing job.
run: node .github/review-ownership/check-approval.mjs in_progress
# SECURITY: dependency setup runs in the check-writing job.
- if: steps.revoke.outputs.active == 'true'
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
@@ -52,7 +52,7 @@ jobs:
- name: Install production lexer
if: steps.revoke.outputs.active == 'true'
run: python3 -m pip install -r .github/review-ownership/requirements.txt
- name: Publish weighted approval status
- name: Publish weighted approval decision
if: steps.revoke.outputs.active == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -63,4 +63,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: node .github/review-ownership/check-approval.mjs error
run: node .github/review-ownership/check-approval.mjs failure