I would like to trigger a github action wf for a specific branch. My branch has the name
refs/heads/release/rc22-15.0.0
I would like to trigger the wf or a specific step for all releases refs/heads/release/**
The execution of the wf triggers both steps.
name: wf_logic_test_releasebranch
on:
workflow_dispatch:
push:
branches:
- 'release/**'
- 'feature/**'
- 'main'
jobs:
test_condition:
name: job_test_condition
runs-on: [atc-ubuntu-20.04]
environment: sandbox
steps:
- name: Branch name
if: github.ref == 'refs/heads/release/rc22-15.0.0'
run: echo running on branch ${GITHUB_REF##*/}
- run: echo ${{github.ref}}
By changing the code to:
name: wf_logic_test_releasebranch
on:
workflow_dispatch:
push:
branches:
- 'release/**'
- 'feature/**'
- 'main'
jobs:
test_condition:
name: job_test_condition
runs-on: [atc-ubuntu-20.04]
environment: sandbox
steps:
- name: Branch name
if: github.ref == 'refs/heads/release/**'
run: echo running on branch ${GITHUB_REF##*/}
- run: echo ${{github.ref}}
The execution of the above wf triggers only the second step.
This is what worked for me: