runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.51k stars 1.02k forks source link

Hide github messages for stale plan comments #4701

Closed userhas404d closed 5 days ago

userhas404d commented 1 week ago

Community Note


Describe the user story

We utilize terragrunt-atlantis-config and as a result often have multiple (large) module plans that can be tedious to scroll through on high churn PRs. Quick and dirty solution for this is often to just close the comment-spammed PR and create new, but if atlantis were "smarter" about how it kept track of the comment threads I think we could avoid this extra step.

Describe the solution you'd like

If a new plan is triggered atlantis should hide existing plan comments with the Outdated reason. Screenshot 2024-06-24 at 10 15 19 AM image

Describe the drawbacks of your solution

it doesn't look like there's an API for this specific operation: https://github.com/orgs/community/discussions/65914 however, there is a graphql endpoint that supports it: https://docs.github.com/en/graphql/reference/mutations#minimizecomment source

An all or nothing approach would definitely be the easiest way to address this, but wouldn't work with scenarios where only a targeted plan is triggered in a PR with multiple workspaces in play. My assumption is that the "comment hiding" logic would need to be aware of which comments correspond to which workspace and if a plan for that workspace has already been triggered + commented on.

I've only considered scenarios where multiple plans are run for the same workspace/set of workspaces within a PR, and am not sure what how this should operate when dealing with multiple applies or if they should just be treated as out of scope.

Describe alternatives you've considered

X-Guardian commented 5 days ago

This feature already exists: https://www.runatlantis.io/docs/server-configuration.html#hide-prev-plan-comments

userhas404d commented 5 days ago

@X-Guardian wow. completely missed this.. thank you!