Cancelling all jobs within a workflow

In the Pyomo repository, we have a workflow that runs a series of jobs in parallel, and once all of those jobs are completed, a post-processing job kicks off to collect coverage reports and upload them to Codecov.

We have an issue, however, that if we want to cancel a job, this only cancels the first suite of tests and then queues the coverage reports, which we cannot cancel while in the “queued” status, so it bogs down our ability to run new jobs until those eventually clear up.

Our trigger for the post-processing job is as follows:

  cover:
    name: process-coverage-${{ matrix.TARGET }}
    needs: build
    if: always() # run even if a build job fails
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

        include:
        - os: ubuntu-latest
          TARGET: linux
        - os: macos-latest
          TARGET: osx
        - os: windows-latest
          TARGET: win

We know that this is happening because of the always() in the conditional if area - which we set up because we want coverage reports, even if some of the previous jobs fail. We do not, however, want the post-processing job to run if the previous jobs were cancelled. Does anyone know what the correct syntax for this might be?

I think you might want !cancelled() as condition. Should run if previous jobs succeeded, failed or skipped.
The job status functions are pretty confusing.

cover:
    name: process-coverage-${{ matrix.TARGET }}
    needs: build
    if: "!cancelled()" # run even if a build job fails
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

        include:
        - os: ubuntu-latest
          TARGET: linux
        - os: macos-latest
          TARGET: osx
        - os: windows-latest
          TARGET: win

BTW You cannot cancel a job which runs if the workflow is cancelled, github actions will ignore your request.