# Using branch "exclude" seems to be ignored

**URL:** <https://drone.discourse.group/t/using-branch-exclude-seems-to-be-ignored/8937>\
**Category:** Drone Support\
**Created:** [August 26, 2021, 8:13am UTC](https://drone.discourse.group/t/using-branch-exclude-seems-to-be-ignored/8937 "2021-08-26T08:13:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Burton](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/thomas_burton/32/6418_2.png) [@Thomas\_Burton](https://drone.discourse.group/u/Thomas_Burton)\
**Post date:** [August 26, 2021, 8:13am UTC](https://drone.discourse.group/t/using-branch-exclude-seems-to-be-ignored/8937/1 "2021-08-26T08:13:33Z")

</div>

My set-up is as follows:

```auto
- name: step1
  when:
    branch:
      - epic/*
- name: step2
  when:
    branch:
      exclude:
        - epic/*
- name: step3
  when:
    branch:
      - epic/*
...

trigger:
  event:
    - pull_request

```

When I push to a new branch named `epic/test-branch` the exact opposite of what I expect happens. Step2 runs and step1 and step3 do not.

Any help

---

<div class="post-metadata">

**Author:** ![Thomas\_Burton](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/thomas_burton/32/6418_2.png) [@Thomas\_Burton](https://drone.discourse.group/u/Thomas_Burton)\
**Post date:** [August 26, 2021, 8:26am UTC](https://drone.discourse.group/t/using-branch-exclude-seems-to-be-ignored/8937/2 "2021-08-26T08:26:19Z")

</div>

Fascinating,

If I run with the `trigger` set to `push` it works as normal. When running with `pull_request` it does the opposite

---

<div class="post-metadata">

**Author:** ![Thomas\_Burton](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/thomas_burton/32/6418_2.png) [@Thomas\_Burton](https://drone.discourse.group/u/Thomas_Burton)\
**Post date:** [August 27, 2021, 7:05am UTC](https://drone.discourse.group/t/using-branch-exclude-seems-to-be-ignored/8937/3 "2021-08-27T07:05:48Z")

</div>

@bradrydzewski I think this is a bug

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [August 27, 2021, 1:46pm UTC](https://drone.discourse.group/t/using-branch-exclude-seems-to-be-ignored/8937/4 "2021-08-27T13:46:18Z")

</div>

I am unable to reproduce the issue.

Here is my test yaml:  
[https://cloud.drone.io/drone/hello-world/285](https://cloud.drone.io/drone/hello-world/285)

And here are the test results:  
[https://cloud.drone.io/drone/hello-world/285](https://cloud.drone.io/drone/hello-world/285)

In terms of pull requests, please keep in mind that drone evaluates conditions against the target branch, not the source branch.

---

<div class="post-metadata">

**Author:** ![Thomas\_Burton](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/thomas_burton/32/6418_2.png) [@Thomas\_Burton](https://drone.discourse.group/u/Thomas_Burton)\
**Post date:** [August 30, 2021, 10:32am UTC](https://drone.discourse.group/t/using-branch-exclude-seems-to-be-ignored/8937/5 "2021-08-30T10:32:46Z")

</div>

> In terms of pull requests, please keep in mind that drone evaluates conditions against the target branch, not the source branch.

Please can you specify a bit more context of what you mean here?

---

<div class="post-metadata">

**Author:** ![Thomas\_Burton](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/thomas_burton/32/6418_2.png) [@Thomas\_Burton](https://drone.discourse.group/u/Thomas_Burton)\
**Post date:** [August 30, 2021, 10:39am UTC](https://drone.discourse.group/t/using-branch-exclude-seems-to-be-ignored/8937/6 "2021-08-30T10:39:43Z")

</div>

Ah wait, I get you.

Do you not think that creates a lot of confusion? My understanding when I specify branch conditions is that I want to evaluate the source branch. For the majority of people, pull requests are made against a single branch, but they have many names (feature/_, bug/_). I would want to run Jobs A, B, C on a feature/\* and D, E, F on a bug/\*. Both are going into develop branch. With this set up how do I differentiate?
