Need to skip a job based on the result of reusable workflow in Github action

203 Views Asked by At

I have a reusable workflow that has 4 jobs in it. Lets say, A, B, C and D.

Now in my caller workflow i have two jobs

Job1 : calls the reusable workflow

Job2 : Comments to PR if any of B, C or D succeeded . If all B, C and D skipped, I want Job 2 to skip

Problem Im facing is that step A in the reusable workflow will always pass and hence the status of by reusable job is always success even if B, C and D skipped.

Solutions tried so far,

tried to set output of reusable workflow to an expression that evaluates the result of B,C and D as below

outputs:
        skip_deployment:
          description: Flag to skip any dependent jobs
          value: ${{ jobs.B.result == 'skipped' && jobs.C.result == 'skipped' && jobs.D.result == 'skipped'}}

But this always returns false. But when I check the jobs context by ToJson(jobs), I can see the results are indeed skipped

I also observed that ${{ jobs.B.result }} is returning empty

0

There are 0 best solutions below