# Build on the same commit SHA triggered twice

**URL:** <https://discuss.bitrise.io/t/build-on-the-same-commit-sha-triggered-twice/4413>\
**Category:** Question & Answer\
**Created:** [March 8, 2018, 9:34am UTC](https://discuss.bitrise.io/t/build-on-the-same-commit-sha-triggered-twice/4413 "2018-03-08T09:34:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmenzyk-rst](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/kmenzyk-rst/32/1277_2.png) [@kmenzyk-rst](https://discuss.bitrise.io/u/kmenzyk-rst)\
**Post date:** [March 8, 2018, 9:34am UTC](https://discuss.bitrise.io/t/build-on-the-same-commit-sha-triggered-twice/4413/1 "2018-03-08T09:34:05Z")

</div>

I have a workflow with 2 triggers: on push branch and on pull request. When I create PR and push to the branch, bitrise triggers 2 (same) builds.

Basically they triggers the same workflow (on the same commit SHA). Shouldn’t it trigger only one build? I would expect it to work that way – one workflow on one commit sha runs once (no matter what triggers so).

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [March 8, 2018, 4:14pm UTC](https://discuss.bitrise.io/t/build-on-the-same-commit-sha-triggered-twice/4413/2 "2018-03-08T16:14:04Z")

</div>

Hi @kmenzyk-rst,

> [@kmenzyk-rst](#):
>
> Basically they triggers the same workflow (on the same commit SHA). Shouldn’t it trigger only one build? I would expect it to work that way – one workflow on one commit sha runs once (no matter what triggers so).

Please see: [Using the Trigger Map to trigger builds - Bitrise Docs](https://devcenter.bitrise.io/webhooks/trigger-map/#dont-start-two-builds-for-pull-requests-from-the-same-repository)

It explains how you can configure the Triggers to only build one of those.

Also explains that the two builds are not 100% the same:

> An important note: although it might seem like both builds are the same, it most likely isn’t! The code push event/build builds the code of the branch, without any merging, etc. It builds the exact same state of the code what you have when you checkout that branch. The Pull Request build on the other hand builds a “pre-merged” state of the code, which is expected to be the state of the code after you merged the pull request.
> 
> Whether you want to build both or just one of these in case of a pull request is up to you and depends on your project’s requirements, but with bitrise you can decide whether you want it or not.

Let us know if you’d have any questions! 😉

---

<div class="post-metadata">

**Author:** ![coltonidle](https://avatars.discourse-cdn.com/v4/letter/c/a4c791/32.png) [@coltonidle](https://discuss.bitrise.io/u/coltonidle)\
**Post date:** [March 9, 2018, 11:25am UTC](https://discuss.bitrise.io/t/build-on-the-same-commit-sha-triggered-twice/4413/3 "2018-03-09T11:25:09Z")

</div>

One is just the branch itself, and another is the branch merged into master (or whatever default is) because on a PR you want to make sure that the merged code will pass your tests and so on?

---

<div class="post-metadata">

**Author:** ![kmenzyk-rst](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/kmenzyk-rst/32/1277_2.png) [@kmenzyk-rst](https://discuss.bitrise.io/u/kmenzyk-rst)\
**Post date:** [March 9, 2018, 11:40am UTC](https://discuss.bitrise.io/t/build-on-the-same-commit-sha-triggered-twice/4413/4 "2018-03-09T11:40:30Z")

</div>

@viktorbenei Thanks for the explanation.

I’ve just disabled triggering builds on code push. Thereby it solved my issue.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [March 13, 2018, 3:29pm UTC](https://discuss.bitrise.io/t/build-on-the-same-commit-sha-triggered-twice/4413/5 "2018-03-13T15:29:01Z")

</div>

Thanks for reporting @kmenzyk-rst and Happy Building! 😉

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [March 13, 2018, 3:30pm UTC](https://discuss.bitrise.io/t/build-on-the-same-commit-sha-triggered-twice/4413/6 "2018-03-13T15:30:16Z")

</div>

@coltonidle exactly, the “PR build” does a local merge, inside the build VM, from the PR’s source to its target, to simulate the state of the code you will get **after** the PR is merged into its target, and so you can run tests on that state, instead of just on the source.

---

<div class="post-metadata">

**Author:** ![rami.saeed](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@rami.saeed](https://discuss.bitrise.io/u/rami.saeed)\
**Post date:** [May 27, 2020, 3:54pm UTC](https://discuss.bitrise.io/t/build-on-the-same-commit-sha-triggered-twice/4413/7 "2020-05-27T15:54:43Z")

</div>

I have the same issue except that I don’t have a push event in trigger map only the pull request, any suggestions ?
