How to take a action based on closer of MR

How to take a action based on closer of MR

Our ci pipline is written in such a way that each branch creates infrastructure and build/deploy code in it, after testing we creates a MR to merge it with master. We are using environment: on_stop to destroy created thing once merge accepted. But on closer of MR we have to destroy everything manually. Is their a way to automate this? Please let me now. :