Strange behavior for conditional serialized jobs

I tried to use serialized jobs with conditions.

I supposed that condition should be applied only for one jobs, but it looks like it is applied to all serialized jobs that it behaves as one job. If any condition is false it finishs workflow.

I have a test Workflow when it is demonstrated

https://github.com/jmalak/test/actions/runs/99224343

Is it possible to ensure continue of next job in thread somehow?

I need to trigger workflow by change in some files and filter trigger events also by branch.

@jmalak ,

You can try the below configurations on  job4 , this should work as expected.

job4:
    runs-on: ubuntu-latest
    needs: job3
    if: github.ref == 'refs/heads/master' && always()
    steps:
    - name: job4
      run: echo "job4"
1 Like

@brightran Thanks, it works as expected.

When I want to run it always even if previous job was not run due to condition is false then I must add

if: always()

condition for such job.

It looks like Workflow has internal condition flag which is global to thread and therefore it is changed by evaluation of each condition.

@jmalak ,

Yeah, currently, if we want a job continues to run when its needs job is failed/canceled/skipped, we seems must use the Job status check functions in the if conditionals of this job.

Thanks a lot for sharing the solution with us