Skip to content

feat: don't leave a comment when there are no changes#414

Open
leetrout wants to merge 1 commit into
techpivot:mainfrom
leetrout:lee/no-comment-no-changes
Open

feat: don't leave a comment when there are no changes#414
leetrout wants to merge 1 commit into
techpivot:mainfrom
leetrout:lee/no-comment-no-changes

Conversation

@leetrout

@leetrout leetrout commented Mar 27, 2026

Copy link
Copy Markdown
  • Adds hide-no-changes-pr-comment input (default: false) to hide the PR comment when there are no
    module changes and no legacy tags/releases pending deletion
    • The comment is still posted (preserving the PR_RELEASE_MARKER for idempotency checks) but minimized via GitHub's GraphQL API so it appears collapsed by default
    • When there are changes to report, comments always post visibly regardless of this flag

Behavior

Scenario hide-no-changes-pr-comment: false (default) hide-no-changes-pr-comment: true
Modules need release ✅ posts comment visibly ✅ posts comment visibly
Legacy tags/releases to delete ✅ posts comment visibly ✅ posts comment visibly
No changes, nothing to delete ✅ posts comment visibly 🔇 posts comment hidden/minimized

AI Disclosure

Used claude for these changes.

@leetrout
leetrout requested a review from virgofx as a code owner March 27, 2026 14:36
@leetrout
leetrout force-pushed the lee/no-comment-no-changes branch from 49347e9 to 849553c Compare March 27, 2026 15:21
@leetrout

Copy link
Copy Markdown
Author

@virgofx thoughts? 😎

@virgofx

virgofx commented Apr 6, 2026

Copy link
Copy Markdown
Member

Hey @leetrout , Thanks for this, the feature makes a lot of sense.

A couple of thoughts:

1. Comment visibility: hidden vs. removed

Would you be open to having the "no changes" comment still posted but as a hidden/minimized comment instead of fully suppressed? That way it shows up like: (Hidden > 'Resolved') mode

image

The reason I bring this up is there's an important idempotency edge case we need to preserve. On merge, we check for the presence of a PR_RELEASE_MARKER in PR comments to prevent duplicate releases on re-runs (see the guard in main.ts). If we fully skip the comment, we need to be careful that the marker logic still works correctly for all failure/retry modes. If we hide rather than skip, we can sidestep that edge case entirely since the marker would still be present in the comment body. It's likely only an issue for the PR-post-build comment (merge-to-main) but will require some additional checks if we fully delete comment.

The other reason - Someone accidently enables this and then is wondering where the comment is. At least here there's a fallback where it could be expanded manually but the out of box experience (which I believe you're trying to streamline) is still achieved?

2. Input naming

I think the input name could be a bit more descriptive. Some alternatives:

  • suppress-no-changes-comment — clearer intent ("suppress" vs "disable")
  • skip-empty-pr-comment — shorter, focuses on what it does
  • hide-no-changes-pr-comment — if we go with the hidden/minimized approach
  • quiet-when-no-changes — concise, describes the behavior

I'm leaning toward hide-no-changes-pr-comment or suppress-no-changes-comment depending on which approach we go with.

What do you think?

--

If you're onboard with the slight change, I'm happy to take this branch and modify to get finalized if that works? Alternatively, I can spin new branch off and close this to preserve yours. LMK

@leetrout
leetrout force-pushed the lee/no-comment-no-changes branch from 849553c to 2d28d72 Compare May 21, 2026 00:34
leetrout added a commit to leetrout/terraform-module-releaser that referenced this pull request May 21, 2026
Per reviewer feedback on PR techpivot#414:
- Post the comment but minimize it via GitHub GraphQL when there are no
  changes, preserving the PR_RELEASE_MARKER for idempotency checks
- Rename input from disable-no-changes-comment to hide-no-changes-pr-comment
  and camelCase field from disableNoChangesComment to hideNoChangesPrComment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@leetrout

Copy link
Copy Markdown
Author

@virgofx all makes sense to me! sorry for the late reply 😞

First: Yes a minimized comment is certainly a great improvement for our eyeballs rushing through PRs!! 😂 🙈

Second: Some more background: we went down this path because we assign our entire team to reviews via the @group tagging. So then for ~95% of our infra PRs we are sending extra emails to them generating more noise in the inboxes due to the (for us) unused comments and it clutters up the view with atlantis as well.

I had the clanker true things up to your comments and catchup to main. The matrix of statistical weights also offered this opinion:

The idempotency guard in main.ts:197 checks for PR_RELEASE_MARKER, which is only ever written by addPostReleaseComment on a merge event. Skipping the no-changes addReleasePlanComment comment has zero effect on the idempotency guard

Adds `hide-no-changes-pr-comment` input (default: `false`). When enabled
and there are no module changes and no legacy tags/releases to delete, the
release plan comment is posted but minimized via GitHub GraphQL so it
appears collapsed by default. Comments always post visibly when there are
changes to report. Preserves the PR_RELEASE_MARKER for idempotency checks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@leetrout
leetrout force-pushed the lee/no-comment-no-changes branch from 2d28d72 to 35a947f Compare May 21, 2026 00:48
@qbedard

qbedard commented Jun 1, 2026

Copy link
Copy Markdown

Is a PR comment the only way to track this state? This method seems brittle. I'm pretty sure it will also fail on high-traffic monorepos due to rate-limiting (a problem I've run into in the past with posting PR comments).

Couldn't it guard against the target cases in other ways? GitHub Actions concurrency groups? Creating a cache entry?

@virgofx

virgofx commented Jun 20, 2026

Copy link
Copy Markdown
Member

Hi @leetrout @qbedard - Sorry for the delay here. I'm working on a new PR, incorporating @leetrout 's changes as well as adding some improved functionality to remove the 1 idempotency marker on post-release to make it more robust. Will keep you all posted.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants