# Aborting merged PR builds

**URL:** <https://discuss.bitrise.io/t/aborting-merged-pr-builds/10382>\
**Category:** Question & Answer\
**Tags:** bitbucket\
**Created:** [September 27, 2019, 8:33am UTC](https://discuss.bitrise.io/t/aborting-merged-pr-builds/10382 "2019-09-27T08:33:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bahadir.onc](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bahadir.onc](https://discuss.bitrise.io/u/bahadir.onc)\
**Post date:** [September 27, 2019, 8:33am UTC](https://discuss.bitrise.io/t/aborting-merged-pr-builds/10382/1 "2019-09-27T08:33:24Z")

</div>

Hello!

When we finalize a PR, we rebase and then fast forward merge. When we rebase a PR, bitrise starts building (because we enabled that webhook) and then when we merge, we close the source branch and then bitrise build fails because git clone fails. Is there any way to abort a build when a PR is merged? Or postpone a build after PR is updated?

Kind regards

---

<div class="post-metadata">

**Author:** ![bitce](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/bitce/32/1639_2.png) [@bitce](https://discuss.bitrise.io/u/bitce)\
**Post date:** [October 15, 2019, 11:12am UTC](https://discuss.bitrise.io/t/aborting-merged-pr-builds/10382/2 "2019-10-15T11:12:39Z")

</div>

Hi @bahadir.onc!

Of course, there are multiple ways to do so 🙂

The evident one is of course with the on-site button, but you could also use the API to do so. [Triggering and aborting builds | Bitrise DevCenter](https://devcenter.bitrise.io/api/build-trigger/#aborting-a-build)

Another feature we have that could help this situation is set up so you have to manually approve PR builds to run. You can read more about that here: [Approving Pull Request builds | Bitrise DevCenter](https://devcenter.bitrise.io/builds/triggering-builds/approving-pull-request-builds/#approving-the-pr-build)

---

<div class="post-metadata">

**Author:** ![bahadir.onc](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bahadir.onc](https://discuss.bitrise.io/u/bahadir.onc)\
**Post date:** [October 15, 2019, 11:41am UTC](https://discuss.bitrise.io/t/aborting-merged-pr-builds/10382/3 "2019-10-15T11:41:12Z")

</div>

Thanks for the help, @bitce

These options are not the ones we’re looking for. We though about something like:

1. When the PR is merged, bitbucket calls bitrise webhook/api to abort the PR  
or
2. PR building job is delayed for a couple of minutes so when we merge, the job is never run.

The API approach is the closest thing we can use, but we’d need to implement our own server which uses both bitbucket and bitrise API’s, right?

Regards

---

<div class="post-metadata">

**Author:** ![bitce](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/bitce/32/1639_2.png) [@bitce](https://discuss.bitrise.io/u/bitce)\
**Post date:** [October 15, 2019, 11:44am UTC](https://discuss.bitrise.io/t/aborting-merged-pr-builds/10382/4 "2019-10-15T11:44:24Z")

</div>

No, you’d just need to make a call for the Bitrise API 🙂 If you could find a way to automate that based on merges, that would be the ideal solution, otherwise I’m not sure you could get Bitbucket to send these requests or delay a hook 😕

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/d/d901cf2aad020f2dd11918afc89ec2089bb87b35.png) [@system](https://discuss.bitrise.io/u/system)\
**Post date:** [November 14, 2019, 11:44am UTC](https://discuss.bitrise.io/t/aborting-merged-pr-builds/10382/5 "2019-11-14T11:44:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
