How to stop pipelines testing a branch that only merged main branch into it + keep previous approvals

Hey guys, I’m looking to skip tests in the following condition.

When I have branch X already in an open MR, (already passed CI/CD + tests), when I merge/rebase main into X, I want my CI/CD process to NOT run tests, it would be totally redundant. Also, I would like to pacify in this codition gitlab’s default behaviour where a new push erases previous approvals, I would like to keep approvals.

To reiterate, the premise and condition here is merging main into X, a branch that already had a successful CI/CD process and now the only change is that it has main inside it.

How can I condition this in my yaml file?
Thank you

Hi @erezt

new push erases previous approvals

This is configurable in Project settings and it’s actually turned off. By default approvals are not erased after additional commits. So someone enabled this feature on your repository. If you are Owner/Maintainer you can find it in Settings -> Merge requests. Otherwise you need to ask someone with such permissions. I personally recommend to keep it on, because any further commits could include changes that are not reviewed. Also there is no reason to actually merge main into feature branch if it doesn’t have conflicts.

when I merge/rebase main into X

Commit is just a commit, and GIT does not differentiate between them. You could have a rule based on CI_COMMIT_MESSAGE since merge commits usually have a standard commit message.

Got it, thank you for answering both questions.
I’m still not sure how is it not industry standard to have a CI/CD stop when it tries to run on something that we know deterministically that it passed all tests.