Skip to content

Automate removal of the ready-for-review label#1568

Open
simongdavies wants to merge 3 commits into
hyperlight-dev:mainfrom
simongdavies:feat/ready-for-review-label
Open

Automate removal of the ready-for-review label#1568
simongdavies wants to merge 3 commits into
hyperlight-dev:mainfrom
simongdavies:feat/ready-for-review-label

Conversation

@simongdavies

@simongdavies simongdavies commented Jun 22, 2026

Copy link
Copy Markdown
Member

What

Automates removal of the ready-for-review label from a pull request once it is
no longer awaiting review.

The label is used to automate requests for review.

The label is removed when any of the following become true:

  • the PR is closed or merged,
  • the PR is converted to a draft,
  • the PR has two or more approvals, or
  • the PR has two or more change requests.

Adding the label stays a manual / author action (now documented in
docs/github-labels.md); only removal is automated.

How

The reusable workflow lives in the organisation's .github repository
(hyperlight-dev/.github) so every repository in the org can share one implementation.

pull_request_target is used so the job has a write-scoped token for pull
requests from forks. This is safe because the engine never checks out or
executes PR code — it only reads PR metadata and removes a label.

Adds a caller workflow that invokes the org-wide reusable manage-ready-for-review workflow to strip the ready-for-review label when a PR is closed or merged, becomes a draft, gains >=2 approvals, or gains >=2 change requests. Documents the label lifecycle in docs/github-labels.md.

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 22, 2026 20:21
@simongdavies simongdavies added kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. area/infrastructure Concerns infrastructure rather than core functionality labels Jun 22, 2026
@simongdavies simongdavies added kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. area/infrastructure Concerns infrastructure rather than core functionality labels Jun 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an automated mechanism to remove the ready-for-review label when a pull request is no longer awaiting review, by wiring repository events into a reusable org-wide workflow. It also documents the intended manual-add / automatic-remove behavior in the project’s label documentation.

Changes:

  • Adds a new GitHub Actions workflow that calls the shared hyperlight-dev/.github “manage-ready-for-review” reusable workflow on relevant PR/review events.
  • Documents the “ready-for-review” label lifecycle (when to add it, and when it will be removed automatically).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/ready-for-review-label.yml Adds the caller workflow that triggers on PR closure/draft conversion and review submission/dismissal, and invokes the pinned org-wide reusable workflow.
docs/github-labels.md Documents the ready-for-review label purpose and the automatic removal criteria.

Comment thread .github/workflows/ready-for-review-label.yml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
@simongdavies simongdavies added the ready-for-review PR is ready for (re-)review label Jun 23, 2026
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
manage-label:
# Shared engine in the org-wide `.github` repository, pinned to a commit SHA
# (matching this repository's action-pinning convention).
uses: hyperlight-dev/.github/.github/workflows/manage-ready-for-review.yml@8eaae4229db908ea64fff06c31dbf5677611ce5e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL too :) https://docs.github.com/en/actions/how-tos/reuse-automations/share-with-your-organization

nit: the comment above sounds very AI-generated

# "ready-for-review" label once a PR is no longer awaiting review.
#
# `pull_request_target` (rather than `pull_request`) is required so that the job
# has a read/write token for pull requests opened from forks. This is safe here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we try this with pull_request first? its only a write for issues and I don't think pull_request_target is needed for that:

permissions:
issues: write

pull_request also has types of closed/converted_to_draft https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree pull_request_target is a code smell. Although it might be better soon https://github.blog/changelog/2026-06-18-safer-pull_request_target-defaults-for-github-actions-checkout/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infrastructure Concerns infrastructure rather than core functionality kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. ready-for-review PR is ready for (re-)review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants