Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Marking GitHub actions workflow as failed if a single job fails in matrix

When running a GitHub Actions matrix workflow, how can we allow a job to fail, continue running all the other jobs, and also mark the workflow itself as failed?

Below in this image, you can see that the workflow passes even after a job failed. We need to mark the workflow as failed in this case.

Image of our workflow results

Here is the small portion of my workflow yaml file. continue-on-error line will continue the workflow even if a job fails but how do we get the whole workflow marked as failed?

   matrixed:
    runs-on: ubuntu-latest
    continue-on-error: true  
    timeout-minutes: 60
    defaults:
      run:
        shell: bash
        working-directory: myDir

    strategy:
      matrix:
        testgroups:
          [
            "bookingpage-docker-hub-parallel",
            "bookingpage-docker-hub-parallel-group-1",
            "bookingpage-payments",
          ]

I did find this unanswered question, but this is about steps and we need to know about jobs.

like image 430
Abilash CS Avatar asked Nov 28 '25 19:11

Abilash CS


1 Answers

Use fail-fast: false for the strategy and don't set continue-on-error on the job.

  matrixed:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    defaults:
      run:
        shell: bash
        working-directory: myDir

    strategy:
      fail-fast: false
      matrix:
        testgroups:
          [
            "bookingpage-docker-hub-parallel",
            "bookingpage-docker-hub-parallel-group-1",
            "bookingpage-payments",
          ]
like image 58
riQQ Avatar answered Dec 02 '25 04:12

riQQ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!