# When condition inside orb job

**URL:** <https://discuss.circleci.com/t/when-condition-inside-orb-job/52650>\
**Category:** Orbs\
**Created:** [January 22, 2025, 2:51pm UTC](https://discuss.circleci.com/t/when-condition-inside-orb-job/52650 "2025-01-22T14:51:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fatmcgav](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/fatmcgav/32/34989_2.png) [@fatmcgav](https://discuss.circleci.com/u/fatmcgav)\
**Post date:** [January 22, 2025, 2:51pm UTC](https://discuss.circleci.com/t/when-condition-inside-orb-job/52650/1 "2025-01-22T14:51:10Z")

</div>

Hi there

I’m trying to add some conditional steps to one of the jobs inside our reusable Orb.

Currently, I’ve got this in my `steps:` section:

```auto
  - run:
      name: Check param
      command: |
        echo "Branch = << parameters.branch >>"
        echo "Circle branch = ${CIRCLE_BRANCH}"
  - when:
      condition:
        matches:
          pattern: /^release.*$/
          value: << parameters.branch >>
      steps:
        - run:
            name: Got to RC condition
            command: |
              echo "I'm a release branch!!!"

```

I’ve tried various combinations of both the `pattern` and `value`, including using `$CIRCLE_BRANCH` env, using `parameters.branch`, making the `branch` param an `env_var_name` type.

However none of them seem to work…

The `check param` step correctly outputs the values I’d expect for both the param and the env var:

```auto
Branch = release/0.0.1
Circle branch = release/0.0.1

```

Any suggestions on how I can get this to work in an Orb?

Thanks  
Gavin

---

<div class="post-metadata">

**Author:** ![wyardley](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/wyardley/32/19231_2.png) [@wyardley](https://discuss.circleci.com/u/wyardley)\
**Post date:** [February 19, 2025, 6:03am UTC](https://discuss.circleci.com/t/when-condition-inside-orb-job/52650/2 "2025-02-19T06:03:47Z")

</div>

Does using `pipeline.git.branch` instead change anything?

Maybe also temporarily try loosening the regex to see if that changes anything?
