# Build not being triggered after a merged Pull Request

**URL:** <https://travis-ci.community/t/build-not-being-triggered-after-a-merged-pull-request/9731>\
**Category:** Deployment\
**Created:** [August 26, 2020, 8:27pm UTC](https://travis-ci.community/t/build-not-being-triggered-after-a-merged-pull-request/9731 "2020-08-26T20:27:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monte47](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@Monte47](https://travis-ci.community/u/Monte47)\
**Post date:** [August 26, 2020, 8:27pm UTC](https://travis-ci.community/t/build-not-being-triggered-after-a-merged-pull-request/9731/1 "2020-08-26T20:27:20Z")

</div>

I have a bunch of different builds that I need Travis to run when I submit a PR with a script that runs tests, and then I want different Travis build to run when I merge that PR that has a deploy script.

So for the Pull Requests builds in my yaml file I have

```auto
if: type IN (pull_request)

```

and then for the other (deployment) builds I have

```auto
if: env(TRAVIS_BRANCH) IN (env(DIST_BRANCH)) AND type NOT IN (pull_request)

```

But for some reason builds are not being triggered upon merges with this configuration.  
When I debug an older build I get:

```auto
$DIST_BRANCH = master
$TRAVIS_EVENT_TYPE = push
$TRAVIS_BRANCH = master

```

as env vars, which checks out with my statement. So I’m confused why it’s not running.

Any help would be greatly appreciated here.

---

<div class="post-metadata">

**Author:** ![mustafa](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/mustafa/32/2752_2.png) [@mustafa](https://travis-ci.community/u/mustafa)\
**Post date:** [August 27, 2020, 7:40am UTC](https://travis-ci.community/t/build-not-being-triggered-after-a-merged-pull-request/9731/2 "2020-08-27T07:40:05Z")

</div>

Hello @Monte47,

Would you consider changing your condition as follows and see if that works?

`(env(TRAVIS_BRANCH) = env(DIST_BRANCH)) AND type NOT IN (pull_request)`

Thanks.

---

<div class="post-metadata">

**Author:** ![Monte47](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@Monte47](https://travis-ci.community/u/Monte47)\
**Post date:** [August 27, 2020, 4:31pm UTC](https://travis-ci.community/t/build-not-being-triggered-after-a-merged-pull-request/9731/3 "2020-08-27T16:31:45Z")

</div>

Hi @mustafa,

Thanks for the response. I tried changing my condition to yours. Unfortunately the jobs still aren’t starting after it was merged.

---

<div class="post-metadata">

**Author:** ![mustafa](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/mustafa/32/2752_2.png) [@mustafa](https://travis-ci.community/u/mustafa)\
**Post date:** [August 27, 2020, 5:04pm UTC](https://travis-ci.community/t/build-not-being-triggered-after-a-merged-pull-request/9731/4 "2020-08-27T17:04:49Z")

</div>

Hey @Monte47, could you please send over a repository name or a build link so I can also check for your build requests as well. Thanks.

---

<div class="post-metadata">

**Author:** ![Monte47](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@Monte47](https://travis-ci.community/u/Monte47)\
**Post date:** [August 27, 2020, 5:16pm UTC](https://travis-ci.community/t/build-not-being-triggered-after-a-merged-pull-request/9731/5 "2020-08-27T17:16:54Z")

</div>

@mustafa Yeah sure, the repo is whil-concepts/whil

- [Build #8668](https://travis-ci.com/github/whil-concepts/whil/builds/181666566) was the last one with that condition. We have since reverted to an old config to keep deployment working.

---

<div class="post-metadata">

**Author:** ![mustafa](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/mustafa/32/2752_2.png) [@mustafa](https://travis-ci.community/u/mustafa)\
**Post date:** [September 3, 2020, 1:25pm UTC](https://travis-ci.community/t/build-not-being-triggered-after-a-merged-pull-request/9731/6 "2020-09-03T13:25:34Z")

</div>

Hello @Monte47,

Sorry about the delay in this case.

It seems like the condition I have suggested already worked actually.

Since your build is a **PR** build your job won’t be created in this condition;

`(env(TRAVIS_BRANCH) = env(DIST_BRANCH)) AND type NOT IN (pull_request)`

and this is what happened in the build link that you have shared.

Thanks.
