Adds automation that keeps the "Work in progress" label in sync with a PR's
review state: present while a review requests changes or any conversation is
unresolved, cleared once neither holds.
GitHub Actions has no trigger for a review conversation being resolved, and
pull_request_review from a fork gets a read-only GITHUB_TOKEN, so a single
pull_request_review-triggered workflow cannot do this. Use a hybrid instead:
- .github/scripts/wip-label.js -- shared logic (reviewDecision + paginated
unresolved reviewThreads -> add/remove the label), so the event and cron
paths can never drift.
- maintenance-listen-review-wip.yml -- listens on pull_request_review with a
read-only token (fork-safe) and just records the PR number as an artifact.
- maintenance-label-wip.yml -- workflow_run worker fired by the listener; runs
in the default-branch context with a write token, checks out the trusted
script and syncs the one PR. Per-PR concurrency, newer reviews supersede.
- maintenance-label-wip-sweep.yml -- scheduled backstop that recomputes the
label for every open PR, catching conversation resolution (which has no
event) and any missed events.
Hardening: the listener artifact is fork-controlled, so the worker downloads it
into RUNNER_TEMP (never the checkout) so it cannot overwrite the trusted script
before github-script runs it; the sweep pins checkout to the default branch so a
workflow_dispatch on another branch cannot run that branch's script; both set
persist-credentials: false.
Also drop "Work in progress" from the blanket removal list in
maintenance-label-on-approval.yml (now owned by this automation) and quote
$GITHUB_OUTPUT there (shellcheck SC2086).
Signed-off-by: Igor Pecovnik <igor@armbian.com>