Un-necessary pipeline running on branch and when merge

I am using Auto DevOps pipeline (https://docs.gitlab.com/ee/topics/autodevops/).

I notice that when a new branch is pushed to repo, Auto DevOps runs on that branch. That’s fine.

However, when a merge request is created from the branch and is merged into master, Auto DevOps runs again.

Is it necessary to run the same code twice?