Merge suggest-reviewers into maintainer-approval as a single workflow#4920
Merged
simonfaltum merged 2 commits intomainfrom Apr 8, 2026
Merged
Merge suggest-reviewers into maintainer-approval as a single workflow#4920simonfaltum merged 2 commits intomainfrom
simonfaltum merged 2 commits intomainfrom
Conversation
The suggest-reviewers workflow posted a comment with reviewer suggestions based on git history. The maintainer-approval workflow checked approval status and set a commit status. This merges both into one workflow so every PR gets a single comment that shows both approval status and reviewer suggestions. Changes: - maintainer-approval.js now scores contributors via git history and posts a comment with approval status per ownership group, reviewer suggestions, and eligible reviewers. Uses delete-then-create for comments so they always appear at the bottom. - maintainer-approval.yml gets pull-requests:write, contents:read, fetch-depth:0 (full history for git log), and skips drafts. - Deleted suggest-reviewers.js and suggest-reviewers.yml. - Updated test-owners-scripts.yml to remove suggest-reviewers path. - Added 7 new tests for comment posting (marker, delete-then-create, per-group, single-domain, all-approved formats). Co-authored-by: Isaac
…oval - Checkout base branch SHA to prevent PR-authored code execution on review events - Add ready_for_review to pull_request_target types so draft promotions trigger - Delete ALL matching comments (not just first) including legacy REVIEWER_SUGGESTION marker - Add concurrency group to prevent overlapping runs per PR Co-authored-by: Isaac
mihaimitrea-db
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
We have two separate workflows for PR review management: one that checks approval status (
maintainer-approval) and one that posts reviewer suggestions (suggest-reviewers). Having them separate means the approval check doesn't tell you who to ask, and the reviewer suggestion doesn't know about approval state. It makes more sense for a single workflow to both check approval AND communicate who's needed.Changes
Before: Two workflows.
maintainer-approvalsets a commit status (pending/success) but says nothing about who to ask.suggest-reviewersposts a comment with git-history-based suggestions but doesn't know about approval state. They run on different triggers and don't share context.Now: One workflow (
PR approval) that does both. Every time it runs, it:maintainer-approval.jsAbsorbed all logic from
suggest-reviewers.js: git history scoring (scoreContributors,gitLog,resolveLogin), comment building (buildComment,buildPerGroupComment), round-robin fallback, and comment management. The comment uses a<!-- MAINTAINER_APPROVAL -->marker. During migration, also cleans up legacy<!-- REVIEWER_SUGGESTION -->comments from the old workflow.Comment management is delete-then-create: each run deletes all existing comments matching the marker, then posts a fresh one. This keeps the comment at the bottom of the conversation timeline.
maintainer-approval.ymlready_for_reviewtopull_request_targettypes (so draft-to-ready gets a comment)pull-requests: write(wasread, needs write to post comments)contents: read+fetch-depth: 0(full history for git log scoring)ref: ${{ github.event.pull_request.base.sha }}to ensure only trusted base-branch code runs onpull_request_revieweventsconcurrencygroup per PR to prevent overlapping runsifconditionDeleted
.github/workflows/suggest-reviewers.js.github/workflows/suggest-reviewers.ymltest-owners-scripts.ymlTests
Test plan
node --test .github/scripts/owners.test.js .github/workflows/maintainer-approval.test.js)<!-- REVIEWER_SUGGESTION -->comments get cleaned upmaintainer-approvalcommit status context