GitLab Ci build triggered on branch delete

Hi!
Is there any way to trigger build on branch delete? Usually we use
git push --delete
to delete branch. Now we have CI job which deploys artifacts to temporary repository on our remote server and it would be great if it also could cleanup after itself. Is it possible with GitLab CI?

1 Like

I’m also using CI to integrate branch code into a testing server. Upon delete I would like to automate the process of stripping that code (cleanup).

On top of that, I would like to perform CI actions only when branches are merged into master. I don’t so much care if the CI runs before or after the merge. I just want to trigger some actions based on the merge into master. Can this be done? I’ve reviewed some outstanding issues and don’t see any final decisions on this.

You can use only: master statement in your gitlab-ci.yml to triger builds only from master.

Thank you. But what what I’m looking for is a master build triggered only by a merge. I’m just interested in capturing the merging branch name. So maybe there is another way to do that?

The event in capturing a deleted branch would actually accomplish more for me. Since all merged branches are eventually deleted.

With the solution you provided, there is no way to tell if/what branch is being merged.

1 Like