[mergify] auto-merge with a new condition to apply if approved > 0 #28435
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fix a corner case and add the condition that the mergify rule is only evaluated if the automated PRs have been approved. The approval can happen automatically (mergify provides a rule for such) or manually by someone else.
Why is it important?
This is only affecting the automated PRs created with the bump of a new ElasticStack snapshot version that happens once a day or when a new ElasticStack release is cut.
Even though in those cases, this issue will not happen always! Only when the build is green (builds in Beats don't always build correctly, since, flakiness in the tests, flakiness in the infrastructure, or third party system, or a PR got merged and broke something...)
What does it happen?
If the automated PR (only the one changing the ES snapshot version or the new release) passed, then it gets tried to be merged, but since there is not an approval (it's required to be approved at least for one person) then it gets merged with the target branch and a new build will happen. This is a sequential process and does not happen often and when it does the recurrence will be avoided since https://github.com/elastic/beats/blob/master/Jenkinsfile#L36