Skip to content

Minimize comment noise in maintainer-approval workflow#4926

Merged
simonfaltum merged 2 commits intomainfrom
simonfaltum/minimize-approval-comments
Apr 10, 2026
Merged

Minimize comment noise in maintainer-approval workflow#4926
simonfaltum merged 2 commits intomainfrom
simonfaltum/minimize-approval-comments

Conversation

@simonfaltum
Copy link
Copy Markdown
Member

Why

The maintainer-approval GitHub Action deletes and recreates its PR comment on every push, review change, and reopen event. Each delete+create cycle sends notifications to all participants, creating unnecessary noise. Approval state comments ("Approved by @user") are also redundant since the commit status already conveys that information.

Changes

Before: every workflow run deletes the old comment and posts a new one, even if nothing changed. Approval events post dedicated "Approved by" comments.

Now: the workflow edits the existing comment in place (no notification), skips the edit entirely when the body hasn't changed, and stops posting approval comments. On approval, any stale pending comment is cleaned up so the PR doesn't show a misleading "Waiting for approval" alongside a green status.

Specifically:

  • Replaced postComment (delete+create) with upsertComment (find, compare, edit-in-place)
  • Removed buildApprovedComment and buildAllGroupsApprovedComment (commit status is sufficient)
  • All three success paths (maintainer approval, maintainer-authored, all groups approved) now only set commit status and clean up stale marker comments
  • Added deleteMarkerComments helper for success-path cleanup

Test plan

  • All 20 unit tests pass (node --test .github/workflows/maintainer-approval.test.js)
  • Tests cover: create when none exists, edit in place, skip when unchanged, duplicate cleanup, stale comment cleanup on approval, no-comment on all success paths

This pull request was AI-assisted by Isaac.

Previously the workflow deleted and recreated the PR comment on every
push, review, and reopen. This caused notification noise for all
participants. Now the workflow edits the existing comment in place
(which does not trigger notifications), skips the edit entirely when
the body has not changed, and stops posting approval comments since
the commit status already conveys that information.

Co-authored-by: Isaac
Address review feedback: when a PR transitions from pending to
approved, delete any leftover marker comments so the PR does not
show a stale "Waiting for approval" comment alongside a green
commit status.

Co-authored-by: Isaac
@github-actions
Copy link
Copy Markdown

Approved (maintainer-authored PR)

See OWNERS for ownership rules.

@simonfaltum simonfaltum merged commit fb37547 into main Apr 10, 2026
26 of 36 checks passed
@simonfaltum simonfaltum deleted the simonfaltum/minimize-approval-comments branch April 10, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants