It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Run pipelines on branch close or pull request merged

Is there a way to run the pipelines for running cleanup actions after a pull request is merged? The merge is never done through the UI but with plain git commands and a push to the main branch.

1 answer

If the merge is local and then distributed to origin via git push, the pipeline you're looking for is in the branches section - it runs when the branch HEAD changes (which it does on push).

Depending on what you would like to find out / to do after merging the branch pipeline can take care of it.

However as the pull request never has been merged through the UI, the only data you can normally work with is the information in the git repository itself as that is shared with Bitbucket and available in the pipeline.

Alternatively you can make use of the Bitbucket API to gather information about open pull requests etc., again looking for git revisions might be a connection point here again.

Not saying there is anything wrong with merging local and pushing to Bitbucket, but I wonder a bit why a pull request is created in the UI if the merge is not done there or more specifically I have problems to give more concrete suggestions as I don't know anything about that cleanup you're talking about in your question.

If it's about closing those pull-requests, then I guess it's about declining the PR via the REST API.

We create test environments with our pull requests, and we open pull requests because everything must be reviewed before pushing to the main branch. What I'm trying to do is after a merge tear down the test environment. The test environment is external to atlassian.

Can you identify the test environment by the merge commit? E.g. a tag or some other property?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,034 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you