How to trigger an event on PR close/merge?


#1

Hello Circle folks.
I have a staging environment which is able to deploy multiple branches of the app at the same time. This helps DEV team to test & develop their stuff.
After a period of time someone should delete all deployments. I would like to automate this step by creating a trigger which will delete deployments if their PR was closed or merged. But unfortunately I don’t understand how to implement it.
Can someone explain how to trigger an event on PR events?


#2

I would expect that depends on who your Git provider is. Are you using GitHub or BitBucket?

I expect both of them will offer HTTP callbacks on a PR event.


#3

Hi halfer
I know about this feature and it is already configured. Actually I don’t understand how to implement it from Circle side. I was unable to find something similar in the documentation.


#4

You can do branch filtering. If you want to do this on PR merge, then that is the same as a change to master (regardless of whether a PR is involved). Branch filtering is covered in the docs, and has been raised many times on this forum.

Please do a search and get a proof-of-concept running; if you get stuck, put your non-working config on this thread, and someone will be happy to help. IMO it’s too broad presently, and anyone assisting would just be copying the docs that already exist.