I have created a workflow with jobs.<job_id>.if but it fails with:
- Your workflow file was invalid: .github/workflows/test.yml (Line: 7, Col: 5): Unexpected value 'if'
Documentation says it should be possible.
I created a small example at: https://github.com/reload/actions-test/pull/1/checks
Edit August 14, 2019: jobs.<job_id>.if has been removed from the documentation now. See workaround below.
As a workaround I moved the if condition into each step in the job.
There are some drawbacks to that though.
I'm having the same issue, putting the `if` in each step is a pain in the ass.
jobs: deploy: name: Publish release # this causes errors if: github.event.action == 'published'
A workaround :(
jobs: checkEvent: runs-on: ubuntu-latest steps: - name: if published if: github.event.action != 'published' run: exit 1 build: runs-on: ubuntu-latest needs: checkEvent
Ok, I tried the aproach now and it doesn't give the result I was hoping for.
Since this workaround will make the check job fail if the condition is met we end up with a failed job on i.e. a Pull Request. I wss aiming at something like neutral / skipped.
So back to if on each step then ...
I have the same problem and have asked github support group for help. And I got their reply just now. It seems jobs doesn't support if statement right now. And the online document is updated and jobs.<job_id>.if seems to be removed.