I'm trying to use an environment variable in an if
condition in github actions like so:
name: Worfklow
on:
push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: EXIT step
if: $GITHUB_REF == 'specific-branch'
run: exit 1
I want to exit if the current branch is equal to a specific branch.
Unfortunately, the github actions console displays an error:
Unexpected symbol: '$GITHUB_REF'
I can use $GITHUB_REF
in a run:
(where it contains the current branch), but not in an if:
. What am I doing wrong?