From this answer I learned, how to set the variable B to 1 if the env.BRANCH_NAME
is 'f1', otherwise set it to 2.
name: ****
on:
push:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
job1:
name: *****
runs-on: *****
steps:
- name: *****
uses: some-action@some-version
with:
A: 1
B: ${{ env.BRANCH_NAME == 'f1' && 1 || 2 }} # <-- I need a change here
I want to change the condition such that the variable is set to 1 if env.BRANCH_NAME
is either of 'f1' or 'f2', otherwise it is set to 2.
In Python, I would do env.BRANCH in ['f1', 'f2']
.
How should it be done here?