How to prevent multiple simultaneous pipelines from running on the same branch in diffrent commit

I want to set the environment not to execute the new pipeline until the old pipeline completes