-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Runner BugBug fix scope to the runnerBug fix scope to the runnerbugSomething isn't workingSomething isn't working
Description
Describe the bug
An if condition in a step definition that includes expression syntax in condition body is always evaluated as false positive or is ignored.
Example workflow: https://github.com/dlavrenuek/test-workflow-if-condition/blob/master/.github/workflows/test.yml
name: test if conditions
on:
push:
branches: [master, test]
env:
TEST_BRANCH: "test"
EMPTY_VALUE: ""
jobs:
test-conditions:
runs-on: ubuntu-latest
steps:
- name: simple evaluation on master
if: github.ref == 'refs/heads/master'
run: echo "runs"
- name: simple evaluation on test
if: github.ref == 'refs/heads/test'
run: echo "runs"
- name: false positive with expression syntac evaluation
if: github.ref == 'refs/head/${{ env.TEST_BRANCH }}' # this condition is ignored or is evaluated as false positive
run: echo "runs"
- name: false positive with expression syntac evaluation
if: false && '${{ env.EMPTY_VALUE }}' # this condition is ignored or is evaluated as false positive
run: echo "runs"Example run: https://github.com/dlavrenuek/test-workflow-if-condition/runs/2914408827?check_suite_focus=true
Example step definition:
- name: false positive with expression syntax evaluation
if: github.ref == 'refs/head/${{ env.TEST_BRANCH }}'
run: echo "runs"In the example workflow the last two steps should not have been run, but they were
To Reproduce
Steps to reproduce the behavior:
- create a workflow
- add an
ifcondition with expression syntax${{ ... }}as part of the condition (not wrapping the whole condition) - trigger the workflow
Expected behavior
- The if condition should be correctly evaluated.
- In case that the expression syntax is not supported as part of an
ifcondition - an error should be thrown instead of silently ignoring it.
Runner Version and Platform
GitHub platform
What's not working?
The steps are executed because of false positive evaluation of he if condition containing expression syntax
ChristopherHX, rgr, JeroenBos, dvishniakov, ee07dazn and 64 more
Metadata
Metadata
Assignees
Labels
Runner BugBug fix scope to the runnerBug fix scope to the runnerbugSomething isn't workingSomething isn't working
