I've been reviewing the gitlab CI docs and can not find anything on how to run a Job when I merge the branch.
Let's say I have a MR where the source branch is feature-1 and I am merging this into master.
Once the branch is merged I want a job to run. Here is what I've tried:
after_merge:
stage: after_merge
image: my_image
only:
- master
- merge_requests
script:
- ls
# more of the script
This job runs when I create the MR but when I merge this MR nothing is happening to master, so I am not sure why it ran.
What I need is this job to run after I merge the code, I have been reviewing this https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-basic and this https://docs.gitlab.com/ee/ci/merge_request_pipelines/index.html but can't figure it out.