Skip to content

feat: suppress or collapse the release plan comment when a PR has no changes#470

Merged
virgofx merged 5 commits into
mainfrom
feat/hide-no-changes-and-self-healing-releases
Jun 21, 2026
Merged

feat: suppress or collapse the release plan comment when a PR has no changes#470
virgofx merged 5 commits into
mainfrom
feat/hide-no-changes-and-self-healing-releases

Conversation

@virgofx

@virgofx virgofx commented Jun 21, 2026

Copy link
Copy Markdown
Member

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. 🙏

This is the first of two PRs split out from #414. The self-healing / idempotent releases work will follow in a separate, focused PR.

What's new

A new boolean input hide-no-changes-pr-comment (default false):

- uses: techpivot/terraform-module-releaser@v2
  with:
    hide-no-changes-pr-comment: true

Behavior

A pull request has nothing to report when all of the following are true:

  • no Terraform modules need a release,
  • no tag/release cleanup is pending (only relevant when delete-legacy-tags is enabled), and
  • the wiki status check did not fail.

When the flag is enabled and a pull request has nothing to report:

Existing Release Plan comment? Result
None yet Nothing is posted — no comment, no email notification.
Already exists (e.g. an earlier push had changes that were later removed) The comment is updated in place and minimized/collapsed via the GraphQL minimizeComment mutation. 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

  • Default is false → behavior is identical to today.
  • Only affects the open-PR Release Plan comment; the post-merge release comment is untouched.
  • Uses the existing pull-requests: write permission — 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.
  • No dist/ changes.

Notes

  • Also includes one small, unrelated commit that de-flakes the terraform-docs install test (it asserted an exact HTTP 404 from the live CDN, which transiently returned 500).

virgofx added 4 commits June 21, 2026 06:12
… 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.
Copilot AI review requested due to automatic review settings June 21, 2026 06:49

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@virgofx virgofx changed the title Feat/hide no changes and self healing releases feat: suppress or collapse the release plan comment when a PR has no changes Jun 21, 2026
…/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.
@github-actions

Copy link
Copy Markdown

📋 Release Plan

Module Type Latest
Version
New
Version
Release
Details
tf-modules-kms patch v1.0.0 🆕 Initial Release
tf-modules-vpc-endpoint patch v1.0.0 🆕 Initial Release

📝 Changelog

tf-modules-kms-v1.0.0 (2026-06-21)

  • 🔀PR #470 - feat: suppress or collapse the release plan comment when a PR has no changes

tf-modules-vpc-endpoint-v1.0.0 (2026-06-21)

  • 🔀PR #470 - feat: suppress or collapse the release plan comment when a PR has no changes

Wiki Statusℹ️

✅ Enabled

Automated Tag/Release Cleanupℹ️

⏸️ Existing tags and releases will be preserved as the delete-legacy-tags flag is disabled.

Powered by:   techpivot/terraform-module-releaser

@sonarqubecloud

Copy link
Copy Markdown

@virgofx
virgofx merged commit 17d40e9 into main Jun 21, 2026
28 checks passed
@virgofx
virgofx deleted the feat/hide-no-changes-and-self-healing-releases branch June 21, 2026 06:59
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