Skip to content

Conversation

@mdayaram
Copy link

what

Adding a new feature to dismiss PR approvals after a plan is completed.

why

Right now Atlantis has the --discard-approval-on-plan option which will dismiss all approvals before it starts planning. However, there's a race condition here where someone could come in and approve the PR while the plan is still running.

Ideally, once the plan is finished, we dismiss any approvals that may have taken place, as they are all considered invalid since they did not have the plan available to review. This is what enabling this new flag does.

This has the added benefit of dismissing pre-mature approvals when a PR is first opened and Atlantis hasn't finished planning the initial plan. If anyone approves during this period, they'll have their approval dismissed once the plan is finally finished.

tests

I have added a few new test cases to test this new feature.

references

NA

@dosubot dosubot bot added feature New functionality/enhancement go Pull requests that update Go code labels Sep 13, 2025
@github-actions github-actions bot added docs Documentation go Pull requests that update Go code labels Sep 13, 2025
Right now Atlantis has the `--discard-approval-on-plan` option which
will dismiss all approvals _before_ it starts planning. However, there's
a race condition here where someone could come in and approve the PR
while the plan is still running.

Ideally, once the plan is finished, we dismiss any approvals that may
have taken place, as they are all considered invalid since they did not
have the plan available to review. This is what enabling this new flag
does.

This has the added benefit of dismissing pre-mature approvals when a PR
is first opened and Atlantis hasn't finished planning the initial plan.
If anyone approves during this period, they'll have their approval
dismissed once the plan is finally finished.

Signed-off-by: Manoj Dayaram <[email protected]>
@mdayaram mdayaram force-pushed the noj/discard-approvals-after-plan branch from 5e1fbee to f7ddf50 Compare September 13, 2025 01:55
},
DiscardApprovalOnPlanFlag: {
description: "Enables the discarding of approval if a new plan has been executed. Currently only Github is supported",
description: "Enables the discarding of approval if a new plan has been executed. Currently supported on GitHub, GitLab, and Gitea",
Copy link
Author

@mdayaram mdayaram Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While writing this PR, I noticed that Gitlab and Gitea implemented the DiscardReviews method, so I added them to the description and documentation.

Copy link
Member

@chenrui333 chenrui333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation feature New functionality/enhancement go Pull requests that update Go code lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants