atlantis
atlantis copied to clipboard
Allowing `Skipped` GitHub status checks to count for the `mergeable` command requirement, when that status check is a `required` one
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
- [ ] I'd be willing to implement this feature (contributing guide)
Describe the user story
Currently, when a GitHub status check is marked as a required status check and has the skipped
result, it does not allow Atlantis to merge the PR, with the following error:
Apply Failed: Pull request must be mergeable before running apply.
We have this use case that a required status check only gets a pass
or fail
if a specific label is present on the PR.
We want it to run on all PRs, but skip when some conditions are met.
Example of a skipped status check:
In this use case, Atlantis counts this PR as non-mergeable, providing the error above.
Describe the solution you'd like
I would like to add the possibility of allowing skipped
status checks as a viable response for a mergeable PR.
I believe that this would be feasible by changing these lines of code: https://github.com/runatlantis/atlantis/blob/fc81a00c8b83543b7260e96e573e45761ca76727/server/events/vcs/github_client.go#L469-L475
With something like:
if isRequiredCheck(*r.Name, required.RequiredStatusChecks.Contexts) {
if (*c.Conclusion == "success" || *c.Conclusion == "skipped") {
continue
}
return false, nil
}
The output of the conclusion
field I got it from the GitHub API docs, with the response schema being shown below:
Describe the drawbacks of your solution This would mean that all skipped status checks would not be counted to the mergeable Atlantis verification, which might not be wanted in some use cases.
Describe alternatives you've considered Changing the methodology we are currently using for the workflow that is being Skipped on these repos, but it's something we would like to avoid.
There is PR to fix a bunch of issues with mergeability and required checks, also enabling atlantis to work with rulesets (or at least required checks from rulesets) - https://github.com/runatlantis/atlantis/pull/4193. Maybe this idea can be integrated there?
@stasostrovskyi , yes, that makes sense, I already added a comment in the PR to see if he can add it to his branch/idea.
@dgteixeira I've implemented this now. It's included in my PR, see https://github.com/runatlantis/atlantis/pull/4193/commits/d288d6cd80b3cdc98f297f088caf1d3d59d21011.