feat: suppress or collapse the release plan comment when a PR has no changes#470
Merged
Merged
Conversation
… release plan comment Adds an opt-in boolean input `hide-no-changes-pr-comment` (default false). When enabled and a pull request has nothing to report (no modules to release, no pending tag/release cleanup, and the wiki check did not fail): - if no Release Plan comment exists yet, none is posted (no comment, no email); - if one already exists, it is updated in place and minimized/collapsed via the GraphQL minimizeComment mutation (an edit, so no new email notification). When the pull request has changes, the comment is posted exactly as before. With the flag false (the default), behavior is unchanged.
…-failure test The "non-existent version" test hits the real terraform-docs.io CDN and asserted an exact 404. The CDN can transiently return other failure codes (observed 500), which flaked the test. Assert the meaningful behavior (correct download URL + curl exit 22 on an HTTP error) without pinning the status code.
…/pull-request.ts:423`.
Swapped the `existingSummaryComments[existingSummaryComments.length - 1]` index access for `.at(-1)`, and folded the empty-list check into a single guard:
```ts
const commentToKeep = existingSummaryComments.at(-1);
if (!commentToKeep) {
info('Hide no-changes PR comment enabled and nothing to report. Skipping comment creation.');
return;
}
```
`.at(-1)` returns `undefined` for an empty list, so the `if (!commentToKeep)` both handles the "no existing comment" case and narrows the type to non-`undefined` for the rest of the block — no non-null assertion needed. Behavior is unchanged and the existing matrix tests (none / one / multiple existing comments) still pass.
📋 Release Plan
📝 Changelog
|
|
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.



Today every open-PR run posts a Release Plan comment — even when the pull request changes no Terraform modules — which spams reviewers on PRs that don't touch a module. This adds an opt-in input to suppress (or quietly collapse) that comment when there's nothing to report.
Supersedes #414. Thanks to @leetrout for raising this and for the original motivation. 🙏
What's new
A new boolean input
hide-no-changes-pr-comment(defaultfalse):Behavior
A pull request has nothing to report when all of the following are true:
delete-legacy-tagsis enabled), andWhen the flag is enabled and a pull request has nothing to report:
minimizeCommentmutation. Because it's an edit, GitHub sends no new email, and the comment stays expandable. Older duplicate summary comments are cleaned up.When the pull request does have changes, the comment is posted exactly as before (delete + recreate, landing at the bottom of the timeline). The update/minimize steps are best-effort — any failure is logged as a warning and never fails the run.
Backwards compatibility
false→ behavior is identical to today.pull-requests: writepermission — no new permissions required.Testing
npm run check,npm run typecheck,npm run textlint— clean.npm run test— green, 100% coverage on the new code. New matrix covers flag on/off × {no changes, pending cleanup, wiki failure, has changes} × {existing comment / none}, plus the non-fatal failure paths for update + minimize.dist/changes.Notes
terraform-docsinstall test (it asserted an exact HTTP404from the live CDN, which transiently returned500).