Search code examples
githubgithub-actionsworkflowpipeline

GitHub pipeline run conditional step isn't working


I have a GitHub pipeline.

I want to run a step conditionally.

I'm running on fix_bug branch

My code:

  - name: Run Step
    if:  ${{ contains(github.ref, 'bug_fix') || github.ref == 'fix_bug' }}
    run: |

Excepted result:

Should run the step (or enter into the step).

Actual result:

Doesn't enter into the step.

The step has the didn't run sign.

enter image description here


Solution

  • Using

      if:  ${{ contains(github.ref, 'bug_fix') || github.ref == 'refs/heads/fix_bug' }}
    

    resolved the issue, but anyone know to tell why I should the prefix refs/heads?

    Tnx