Skip to content

fix(scripts): run the comment-lint gate in check-affected.sh #22349

fix(scripts): run the comment-lint gate in check-affected.sh

fix(scripts): run the comment-lint gate in check-affected.sh #22349

name: PR Review Hosted
# Locally owned: the `claude-review-hosted-caller` component of
# melodic-software/standards
# (https://github.com/melodic-software/standards/blob/main/components/claude-lanes-hosted/claude-review.yml)
# is `locally-owned` for this repository in distribution/sync-manifest.yml, so
# this copy can add the check-kill-switch and wait-for-refine jobs
# below. It differs from the component in those jobs and these comments.
#
# Thin caller for the org's pr-review-cli reusable, lane `code`. The reusable
# owns the launcher, the credential order (the reviews role's API key, then
# its subscription token after a handoff) and the secret-handling model; per
# its header, this caller owns the triggers, concurrency, and the GITHUB_TOKEN
# permission grant (a called workflow can only downgrade the caller's grant,
# never elevate it).
#
# The reusable skips fork PRs (they receive no secrets and a read-only token),
# Dependabot, and every `[bot]` actor whose sender id is not in
# `allowed-bot-sender-ids` (below), so none is reviewed by design. On a public
# repository that means the lane reviews only pull requests from branches of
# this repository: fork and Dependabot pull requests get no secrets.
#
# RUNNER PLACEMENT: every job of the reusable runs on ubuntu-24.04; it takes
# no runner input. The job id `pr-review` keeps the check
# `pr-review / claude-review-status`.
#
# No ruleset requires this check. ci-status, the one required check, needs
# its success on the head and fails while the hold label is on (github-iac
# ADR 0017).
# API_BUDGET_HOLD (outage posture element 2): only wait-for-refine's wait step sets it,
# since wait-refine.mjs reviews on a refused call. The other steps gate the review
# (check-trusted-trigger, the upstream status) or end red on a failed read.
# A step opts in only once its script is shown to hold green with a notice on
# a refused call (rate-guard.mjs createRateLimitLatch); a gate never does, since
# a hold would pass what it could not read, so the rest still end red on a
# rate limit past the guard's budget.
on:
pull_request:
# `synchronize` re-reviews every push, including the push that resolves a
# merge conflict: GitHub runs no pull_request workflow while a PR
# conflicts with its base, so a once-per-PR trigger set silently skipped
# any PR that conflicted when it opened. The reusable narrows a push's
# review to the files changed since the lane's last completed review and
# skips a push that changed none of the PR's files; opened, reopened and
# ready_for_review review the whole PR.
#
# Re-running the job does NOT review a newer head: a re-run replays the
# ORIGINAL event payload. Push to review the current head.
types: [opened, synchronize, ready_for_review, reopened]
permissions:
contents: read
# Per-PR group: a newer event for the same PR waits for the running review
# instead of cancelling it, because the guardrails merge guard reads a
# cancelled run as red. The security caller does the same. The group is the
# `${{ github.workflow }}`-prefixed canonical form the standards
# `concurrency-policy` component requires.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: false
jobs:
# The reusable reads no kill switch, so this caller does. The org
# and repository switches fail closed (check-kill-switch); the lane's own
# CLAUDE_REVIEW_DISABLED stops it only at `true`, as github-iac's README
# documents for the review-lane switches. A failed job leaves proceed empty,
# which also stops the review.
check-kill-switch:
name: Check Kill Switch
if: github.event.pull_request.draft == false
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read # check out the default branch for the kill-switch action
outputs:
proceed: ${{ steps.kill.outputs.proceed == 'true' && steps.upstream.outputs.degraded != 'true' && vars.CLAUDE_REVIEW_DISABLED != 'true' && 'true' || 'false' }}
env:
API_BUDGET_TOKEN: github-token
steps:
- name: Resolve main's tip
id: tip
env:
TIP_BRANCH: main
GIT_TERMINAL_PROMPT: "0"
run: |
until sha=$(timeout 60 git -C "$RUNNER_TEMP" ls-remote "https://github.com/$GITHUB_REPOSITORY.git" "refs/heads/$TIP_BRANCH" |
awk -v ref="refs/heads/$TIP_BRANCH" '$2 == ref { print $1 }') && [[ $sha =~ ^[0-9a-f]{40}$ ]]; do
((++i < 3)) || { echo "::error::the tip of $TIP_BRANCH did not resolve"; exit 1; }
sleep "$((RANDOM % (2 * i + 1)))"
done
echo "sha=$sha" >>"$GITHUB_OUTPUT"
- name: Check out the default branch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.tip.outputs.sha }}
path: .base
persist-credentials: false
sparse-checkout: |
/.github/actions/check-kill-switch/
/.github/actions/check-upstream-status/
/.github/scripts/maintenance-reconcile-lost-runs/component-status.mjs
/.github/actions/setup-pinned-node/
/.node-version
/.github/actions/log-api-budget/
/docs/conventions/pr-pipeline.yaml
sparse-checkout-cone-mode: false
- name: Set up Node
uses: ./.base/.github/actions/setup-pinned-node # zizmor: ignore[self-repository]
with:
node-version-file: .base/.node-version
- name: Read the defer override from the base config
continue-on-error: true
run: |
yq -o=json '{"limits": {"api": (.limits.api // {})}}' .base/docs/conventions/pr-pipeline.yaml >"$RUNNER_TEMP/defer-config.json"
# A first attempt defers (cause defer) while the GITHUB_TOKEN window is
# projected to run short before the review ends; the stop below names
# the reset, and the lost-run reconciler re-runs the run once after it
# (https://github.com/melodic-software/claude-code-plugins/blob/main/.github/actions/check-kill-switch/README.md).
# A re-run attempt never defers.
- name: Check the kill switch
id: kill
uses: ./.base/.github/actions/check-kill-switch # zizmor: ignore[self-repository]
with:
value: ${{ vars.CLAUDE_LANES_DISABLED }}
repo-value: ${{ vars.CLAUDE_LANES_REPO_DISABLED }}
defer: "true"
defer-job: review
resolved-config: ${{ runner.temp }}/defer-config.json
# Skips the run while Actions or npm installs list an outage, with a
# logged reason; fails open (.github/actions/check-upstream-status).
- name: Check upstream status
id: upstream
if: steps.kill.outputs.proceed == 'true'
continue-on-error: true
timeout-minutes: 2
uses: ./.base/.github/actions/check-upstream-status # zizmor: ignore[self-repository]
- name: Report the kill switch
if: steps.kill.outputs.proceed != 'true' || vars.CLAUDE_REVIEW_DISABLED == 'true'
env:
REASON: ${{ steps.kill.outputs.reason }}
CAUSE: ${{ steps.kill.outputs.cause }}
RESET: ${{ steps.kill.outputs.reset }}
LANE_SWITCH: ${{ vars.CLAUDE_REVIEW_DISABLED }}
run: |
echo "::notice::a kill switch stops this review (lanes: ${REASON:-unreadable} cause=${CAUSE:-unreadable} reset=${RESET:-none}, CLAUDE_REVIEW_DISABLED: ${LANE_SWITCH:-unset})"
# A skip fails this job, so the run is a failed first attempt: the
# lost-run reconciler re-runs it once GitHub Actions is operational
# (reconcile.mjs `upstream`), the merge gate binds that re-run on this
# error (babysit_review_evidence UPSTREAM_STOP_RE), and ci-status names
# the stop. The reason is the gate's own one-line output.
- name: Stop on upstream status
if: steps.kill.outputs.proceed == 'true' && steps.upstream.outputs.degraded == 'true' && vars.CLAUDE_REVIEW_DISABLED != 'true'
env:
REASON: ${{ steps.upstream.outputs.reason }}
run: |
echo "::error::an upstream outage stops this review (${REASON:-unknown}); the lost-run reconciler re-runs it once GitHub Actions is operational"
exit 1
- name: Log the API budget at the end
if: always()
continue-on-error: true
timeout-minutes: 1
uses: ./.base/.github/actions/log-api-budget # zizmor: ignore[self-repository]
with:
tokens: github-token
# The review waits for this head's Refine (pr-refine.yml fix-docs), so it
# judges tidied code. It waits here, inside this pull_request run, because
# ci-status and the other review readers find only pull_request runs on the
# head, and a Refine started with GITHUB_TOKEN fires no workflow_run event
# that could start a review after it. A head that moved while it waited is
# not reviewed: the push that moved it, Refine's or another, starts the
# new head's review. Every other outcome reviews, and a wait step that
# fails or times out leaves proceed empty and the job green, which reviews
# too (.github/scripts/pr-review/wait-refine.mjs). It waits only when the
# kill switch lets the review run.
wait-for-refine:
name: Wait For Refine
needs: [check-kill-switch]
if: github.event.pull_request.draft == false && needs.check-kill-switch.outputs.proceed == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 50
permissions:
actions: read # the dispatcher and pr-refine runs and the dispatch record
contents: read # check out the default branch for the script; each poll's read of refs/pull/<n>/head
pull-requests: read # the pull request's state and head at the end, at a poll whose ref read differs or fails, and at the start only when the event lacks the base ref or head repository
outputs:
proceed: ${{ steps.wait.outputs.proceed }}
env:
API_BUDGET_TOKEN: github-token
steps:
- name: Resolve main's tip
id: tip
env:
TIP_BRANCH: main
GIT_TERMINAL_PROMPT: "0"
run: |
until sha=$(timeout 60 git -C "$RUNNER_TEMP" ls-remote "https://github.com/$GITHUB_REPOSITORY.git" "refs/heads/$TIP_BRANCH" |
awk -v ref="refs/heads/$TIP_BRANCH" '$2 == ref { print $1 }') && [[ $sha =~ ^[0-9a-f]{40}$ ]]; do
((++i < 3)) || { echo "::error::the tip of $TIP_BRANCH did not resolve"; exit 1; }
sleep "$((RANDOM % (2 * i + 1)))"
done
echo "sha=$sha" >>"$GITHUB_OUTPUT"
- name: Check out the default branch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.tip.outputs.sha }}
path: .base
persist-credentials: false
# wait-refine.mjs and the modules it imports.
sparse-checkout: |
/.github/actions/check-kill-switch/
/.github/actions/check-trusted-trigger/
/.github/actions/log-api-budget/
/.github/actions/setup-pinned-node/
/.github/scripts/pr-review/
/.github/scripts/pr-unblock/request-budget.mjs
/.node-version
sparse-checkout-cone-mode: false
- name: Set up Node
uses: ./.base/.github/actions/setup-pinned-node # zizmor: ignore[self-repository]
with:
node-version-file: .base/.node-version
- name: Wait for this head's refine run
id: wait
continue-on-error: true
timeout-minutes: 45
env:
GITHUB_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
API_BUDGET_HOLD: "1"
run: node .base/.github/scripts/pr-review/wait-refine.mjs
- name: Log the API budget at the end
if: always()
continue-on-error: true
timeout-minutes: 1
uses: ./.base/.github/actions/log-api-budget # zizmor: ignore[self-repository]
with:
tokens: github-token
pr-review:
name: PR Review
needs: [check-kill-switch, wait-for-refine]
# A draft is work in progress and does not spend a review; the
# ready_for_review trigger above is what delivers one when it is ready.
# Only wait-for-refine's proceed=false (the head moved while it waited) skips
# the review.
if: ${{ !cancelled() && github.event.pull_request.draft == false && needs.check-kill-switch.outputs.proceed == 'true' && needs.wait-for-refine.outputs.proceed != 'false' }}
# The model jobs narrow this to contents: read and pull-requests: read;
# only the reusable's status job (the claude-review-status check) writes.
permissions:
actions: read # the reusable's check-key-credit job reads this
# workflow's runs for the key's recent credit stop,
# and its status job reads them for cost decisions
checks: read # the reusable's status job reads its earlier
# runs' cost notices
contents: read
pull-requests: write # the review, its inline comments and the lane's
# reviewed-head marker comment
uses: melodic-software/ci-workflows/.github/workflows/pr-review-cli.yml@main
with:
lane: code
publish: comments
lane-transcript-public-key: ${{ vars.LANE_TRANSCRIPT_PUBLIC_KEY }}
# The key's credit window every model lane reads (callers.test.mjs
# KEY_CREDIT_WINDOW); empty runs the reusable's 1-hour default.
key-credit-window-hours: ${{ vars.KEY_CREDIT_WINDOW_HOURS }}
# The time the key was last replaced: a credit stop before it no longer
# holds the key off.
key-credit-reset-at: ${{ vars.KEY_CREDIT_RESET_AT }}
# Bot senders this lane reviews, by numeric user id: the
# automation-lanes App, so a commit it pushes to a pull request is
# reviewed. Where the repository does not set this variable the value is
# empty and the reusable reviews no bot.
allowed-bot-sender-ids: ${{ vars.AUTOMATION_LANES_APP_SENDER_ID }}
# People whose closing issues the review reads in full, by numeric user
# id: the `human` entries of .github/standards/trusted-actors/trusted-actors.json
# (standards components/trusted-actors/trusted-actors.json). Empty
# would replace every person's closing issue with a placeholder. The
# bot ids in allowed-bot-sender-ids above also mark issues those bots
# wrote as trusted closing-issue context.
allowed-author-ids: '153232337'
# Empty, as pr-review.yml's default was: the code lane reviews every
# change, documentation included.
docs-only-paths: ''
# Copies scripts/sync-shared-copies.sh generates, read at the merge base:
# identical changes to copies of one source are read once, hooks included.
generated-copies: scripts/shared-copies.txt
# Generated data files counted as read, read at the merge base.
generated-data: scripts/review-generated-data.txt
media-paths: scripts/review-media-paths.txt
binary-allowlist: scripts/review-binary-allowlist.txt
# A hold adds this label and a `claude-lane-hold` marker comment; ci-status
# fails while the label is on. The review holds only for a real-charge
# cost or a CRITICAL security finding; hold-paths names the files the
# prompt sends to extra security scrutiny and never holds by itself.
# scripts/sync-hold-floor.py writes the list from the floor,
# the same in both callers; ci-status's exempt-author hold_patterns name
# the same paths less the security review's own files, which are
# scrutiny only.
hold-label: needs-human
# BEGIN hold-floor hold-paths: generated by scripts/sync-hold-floor.py
hold-paths: |
.github/standards/trusted-actors/**
**/CODEOWNERS
docs/conventions/pr-pipeline.yaml
**/.gitmodules
plugins/source-control/skills/babysit-prs/scripts/babysit_risk.py
plugins/source-control/skills/babysit-prs/scripts/babysit_check_inputs.py
plugins/source-control/skills/babysit-prs/scripts/babysit_checks.py
plugins/source-control/skills/babysit-prs/scripts/babysit_classify.py
plugins/source-control/skills/babysit-prs/scripts/babysit_dependabot.py
plugins/source-control/skills/babysit-prs/scripts/babysit_feedback.py
plugins/source-control/skills/babysit-prs/scripts/babysit_gh.py
plugins/source-control/skills/babysit-prs/scripts/babysit_lane_binding.py
plugins/source-control/skills/babysit-prs/scripts/babysit_merge.py
plugins/source-control/skills/babysit-prs/scripts/babysit_merge_policy.py
plugins/source-control/skills/babysit-prs/scripts/babysit_merge_settings.py
plugins/source-control/skills/babysit-prs/scripts/babysit_postmerge.py
plugins/source-control/skills/babysit-prs/scripts/babysit_repo_config.py
plugins/source-control/skills/babysit-prs/scripts/babysit_review_evidence.py
plugins/source-control/skills/babysit-prs/scripts/babysit_review_trigger.py
plugins/source-control/skills/babysit-prs/scripts/babysit_run_cache.py
plugins/source-control/skills/babysit-prs/scripts/babysit_state.py
plugins/source-control/skills/babysit-prs/scripts/babysit_tracker_binding.py
plugins/source-control/skills/babysit-prs/scripts/babysit_util.py
plugins/source-control/skills/babysit-prs/scripts/babysit_verify_evidence.py
plugins/source-control/skills/babysit-prs/scripts/babysit_whole_review.py
**/.claude/**
docs/conventions/source-control.yaml
**/.claude-lane/**
**/.mcp.json
**/CLAUDE.md
**/CLAUDE.local.md
**/AGENTS.md
REVIEW.md
.github/actions/check-trusted-trigger/**
.github/actions/resolve-config/**
.github/actions/check-kill-switch/**
.github/actions/request-lane-token/**
.github/source-control-settings.json
.github/verify-legacy-fails.json
.github/actions/log-api-budget/rate-guard.mjs
.github/actions/log-api-budget/api-budget.bash
.github/actions/log-api-budget/rate-limits.json
.github/scripts/pr-merge/merge-holds.mjs
.github/scripts/pr-merge/enable-auto-merge.mjs
.github/scripts/pr-merge/superseded.mjs
.github/scripts/pr-merge/clear-escalations.mjs
.github/scripts/pr-merge/release-eval-hold.mjs
.github/scripts/pr-merge/carry-run-cache.mjs
.github/scripts/pr-merge/gate-check.mjs
.github/scripts/pr-merge/head-ref-map.mjs
.github/scripts/pr-merge/lane-records.mjs
.github/scripts/pr-merge/last-report.mjs
.github/scripts/pr-merge/rate-stop.bash
.github/scripts/pr-merge/retry-call.bash
.github/scripts/pr-merge/refire-refused.mjs
.github/scripts/pr-merge/rotation.mjs
.github/scripts/pr-merge/sweep-summary.mjs
.github/scripts/pr-merge/who.mjs
.github/scripts/pr-merge/post-unarmed-status.mjs
.github/scripts/pr-merge/verify-answers.mjs
.github/scripts/lib/run-title.mjs
.github/scripts/pr-merge/merge-risk-line.mjs
.github/scripts/pr-merge-risk/input.mjs
.github/scripts/pr-merge-risk/write-rating.mjs
.github/actions/report-check-run/posting-run.mjs
scripts/sync-hold-floor.py
.github/scripts/pr-unblock/address-feedback.mjs
.github/scripts/pr-unblock/escalation-routes.mjs
.github/scripts/pr-unblock/escalation-routes.json
.github/scripts/pr-unblock/gate-source.mjs
.github/scripts/pr-unblock/thread-scope.mjs
.github/scripts/lib/retry-fetch.mjs
.github/scripts/work-resolve-issue/report-outcome.mjs
.github/scripts/work-resolve-issue/limits.mjs
.github/scripts/lib/lane-hold-marker.mjs
.github/scripts/pr-unblock/report-escalation.sh
.github/scripts/pr-unblock/adjudicate-feedback.mjs
.github/scripts/pr-unblock/publish-feedback.mjs
.github/scripts/pr-unblock/resolve-threads.mjs
.github/scripts/pr-unblock/request-budget.mjs
.github/scripts/pr-verify/resolve-pr.mjs
.github/scripts/pr-verify/write-verdict.mjs
.github/scripts/intake-triage/admit.mjs
.github/actions/select-trusted-text/select-trusted-text.mjs
lib/publish-gate.mjs
.github/recurring-schedule.json
docs/upstream/**
scripts/upstream-drift-vendored-report.sh
.github/scripts/recurring-schedule/file-due.mjs
.github/scripts/maintenance-monitor-signals/issues.mjs
.github/scripts/lib/github-rest.mjs
plugins/work-items/scripts/charge-words.json
.github/scripts/pr-unblock/dependency-classify.mjs
.github/scripts/apply-patch/apply-patch.mjs
.github/scripts/apply-patch/predicates.mjs
.github/scripts/apply-patch/protected-paths.mjs
.github/scripts/lib/run-main.mjs
.github/scripts/pr-unblock/fix-ci-context.mjs
.github/scripts/pr-unblock/feedback-dispatch.mjs
.github/scripts/pr-unblock/verify-notes.mjs
.github/scripts/pr-unblock/earlier-fail-notes.mjs
.github/scripts/pr-unblock/limit-stop.mjs
.github/scripts/lib/lane-outcome.mjs
.github/scripts/lib/lane-binding.mjs
.github/scripts/pr-unblock/lane-record-cache.mjs
.github/scripts/pr-unblock/dispatch-record.mjs
.github/scripts/pr-unblock/verify-cap.mjs
.github/scripts/maintenance-reconcile-lost-runs/infra-failure.mjs
.github/scripts/work-resolve-issue/stop-routes.json
.github/scripts/work-resolve-issue/stop-routes.mjs
.github/scripts/work-resolve-issue/known-names.json
.github/scripts/lib/stop-reason.mjs
.github/scripts/lib/admission-comment.mjs
.github/scripts/lib/admission-record.mjs
.github/scripts/lib/done-evidence.mjs
.github/scripts/pr-review-main/**
docs/conventions/instruction-exception-register/**
docs/conventions/untrusted-content/**
docs/standards/**
docs/review/**
.github/scripts/intake-triage/triage-rubric.txt
.github/scripts/intake-triage/refine-schema.json
.github/scripts/plugin-eval/policy-probe-prompt.txt
.github/workflows/intake-reenter.yml
.github/workflows/intake-triage.yml
.github/workflows/maintenance-audit-lane-runs.yml
.github/workflows/maintenance-measure-skill-edit-pass.yml
.github/workflows/maintenance-measure-skill-edit.yml
.github/workflows/maintenance-reconcile-lost-runs.yml
.github/workflows/maintenance-repin-ci-workflows.yml
.github/workflows/maintenance-tidy-code-upkeep.yml
.github/workflows/post-merge-file-demotion-issues.yml
.github/workflows/post-merge-test-mutation.yml
.github/workflows/pr-dispatch-feedback.yml
.github/workflows/pr-merge.yml
.github/workflows/pr-rate-merge-risk.yml
.github/workflows/pr-refine.yml
.github/workflows/pr-require-checks.yml
.github/workflows/pr-review-approved.yml
.github/workflows/pr-review-comment-relay.yml
.github/workflows/pr-review-hosted.yml
.github/workflows/pr-review-main.yml
.github/workflows/pr-review-security-hosted.yml
.github/workflows/pr-run-activity-read.yml
.github/workflows/pr-run-activity-write.yml
.github/workflows/pr-run-plugin-evals.yml
.github/workflows/pr-unblock-dispatch.yml
.github/workflows/pr-unblock.yml
.github/workflows/pr-verify.yml
.github/workflows/release-generate-dependabot-changelog-fragments.yml
.github/workflows/release-publish-plugins.yml
.github/workflows/upstream-apply-changelog.yml
.github/workflows/work-resolve-issue.yml
.github/workflows/work-unblock.yml
plugins/review/skills/security-review/**
plugins/review/evals/security-review-*/**
# END hold-floor hold-paths
# The reviews role's key runs first; its subscription token only after the
# key hands off, and the central fallback token only after the
# subscription token hands off. Named secrets only, never `secrets: inherit`.
secrets:
CLAUDE_API_KEY: ${{ secrets.REVIEWS_CLAUDE_API_KEY }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.REVIEWS_CLAUDE_CODE_OAUTH_TOKEN }}
FALLBACK_CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.FALLBACK_CLAUDE_CODE_OAUTH_TOKEN }}