Calling core.setFailed() doesn't mark step as failed

Even though I called core.setFailed() in my error handling code, it didn’t mark the step as failed. I would like to be able to give users the chance to retry the workflow. I’m not sure if I’m doing something wrong.

Issue summarized here: https://github.com/williamhaw/setup-wiremock-action/issues/2

Code: https://github.com/williamhaw/setup-wiremock-action/blob/master/index.js

Hi @williamhaw , 

I checked core.setFailed() in my side, it will mark the step as failed. 

Your issue is caused by " continue-on-error: true" in your Action E2E Test step , it will mark the step succeed.  

- name: Action E2E Test
        uses: ./
        id: setup-wiremock
        with:
          mappings: 'example-mapping-directory'
          files: 'example-files-directory'
          command: 'node example.test.js'
          verbose: true
        # continue-on-error: true
      - name: Get the WireMock standard output
        if: always()
        run: echo "${{ steps.setup-wiremock.outputs.wiremock-stdout }}"

You could remove the continue-on-error option. 

If you still want to run the next step, you could add if: always() in the next step. 

1 Like

Aha PEBKAC strikes again! I originally added continue-on-error because I needed to debug something but it’s no longer needed. Thanks!