Github Actions if condition requires "always()" to run but that makes it not cancellable

Hi Community.

I am having this weird situation where my job’s if condition requires to have the “always()” function in order to run. If I use another function like “success()” or even putting “true” hardcoded doesn’t work. The problem with using “always()” is that now the job cannot be cancelled.

Here’s the job if piece:

    needs: [build-matrix]
      terraservice_name: "00-workspace-variables"
    if: |
      always() && == 'success' && != null &&
      contains(fromJson(, 'environments/dev-centralus/00-workspace-variables') &&
      contains(fromJson(, 'environments/dev-centralus/00-workspace-variables')

use success() || failure() , it should make the job always run but also not run if you cancel.

Tried that but behaves like the case I said of removing the always() the job is skipped :frowning:


You want, success is false if any job where skipped

if: "!cancelled()"

My own cheatsheet for job if’s

1 Like

That worked like a charm @ChristopherHX thanks a lot for the cheatsheet