0

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

ASHISH M.G
  • 522
  • 2
  • 7
  • 23
  • I would suggest using [outputs](https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-outputs-from-a-reusable-workflow) from the reusable workflow. You could set one output per reusable workflow job, and check those outputs in a if condition on the main workflow second job, to perform the operation or not. – GuiFalourd Aug 14 '23 at 19:02

0 Answers0