Running a GitHub Actions step only if specific steps failed


I’d like to run a step only if specific previous steps FAILED with Exit Code different from Zero.
I’ve tried the code below but it not working.
How can I do that?

- name: JobA
  id: seedBuild
  run: |
        echo "::set-output name=exit_code::$(echo -n "$?")"

- name: JobB
  id: allJobs
  run: |
        echo "::set-output name=exit_code::$(echo -n "$?")"

- name: Debug Job Failure
  run: |
        echo "******** Job Logs from ********"
  if: "${{ steps.seedBuild.outputs.exit_code != 0 || steps.allJobs.outputs.exit_code != 0 }}"

If by “not working” you mean that the debug step runs when it shouldn’t, check the Job status check functions documentation:

If your if expression does not contain any of the status functions it will automatically result with success().

What exactly “will automatically result” means is a bit unclear (is that an “and”, an “or”, something else?) but either way you could try to connect your check with something like && always(). But maybe a simple if: failed() would already do the job?