-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong behaviour when combining 'continue-on-error' and 'failure()' in subsequent steps #1034
Comments
Hello ? Any update there ? |
@jorgesolebur I believe this is intentional behavior. By setting In your case, I would use the -name: Step 1
id: step1
continue-on-error: true.
run: 'blabalbalba'
-name: Step 2
if: steps.step1.outcome != 'success'
run: 'bloblboblo' |
Thanks @henrygriffiths , This works but the documentation does not reflect it being intentional, although your example made me understand it. The documentation for Asked in a different way, If continue on error actually made the step not fail, so failure() does not work, then why is GitHub action runner reporting a failure for the job? Since the step actually failed, I would expect failure to trigger from if: context to work. But it is not a big deal. It would just be nice to have it listed under Just to be crystal clear: jobx:
continue-on-error: true
steps:
-name: Step 1
run: 'blabalbalba'
-name: Step 2
if: ${{ failure() }}
run: 'bloblboblo' works and Step 2 executes only if step 1 fails. But jobx will be marked as an overall failure(). |
This leads to fake "success" of the pipeline. As of today. Yes, it worked before. But does not work anymore. |
Hi @pkit, What specifically does not work anymore? I tried the above code and it worked, Step 1 failed but Step 2 still ran. See https://github.com/henrygriffiths/test-actionstoolkit1034/actions/runs/8240794844/job/22536864238 |
Runner version: |
I'm seeing the same in my test workflow. Another workaround for your specific requirements could be to manually call the failure in a subsequent step, eg -name: Step 1
id: step1
continue-on-error: true
run: 'command that may fail'
- Additional Steps
-name: Check Step 1
if: steps.step1.outcome != 'success'
run: echo 'Step 1 Failed'; exit 1 |
Yeah, but I don't really want to use some special calling conventions for the "on failure" steps. |
Thanks @henrygriffiths . This is unexpected:
Ppl are bound to interpret "on-error" as meaning "on error" => "when an error has occurred". As in, "the step DID fail". |
Describe the bug
I found an issue when combining continue-on-error in a step 1 and failure()' in a step 2. It is not working as expected.
In my scenario I have a step 1 that in case if it fails, I would like to run step 2 instead. If step 1 fails, I do not want to job to show as failed. This is why I am using a combination of continue-on-error and failure(). However I do not think it is working as intended.
To Reproduce
Prepare a YAML file like the following:
When running the workflow in GitHub Actions, if step 1 fails then step 2 is not executed, which does not make sense because step2 is defined to be executed in case step 1 fails.
Expected behavior
If Step 1 does not fail -> Step 2 is not executed (this is working already as expected)
If Step 1 fails -> Step 2 should be triggered AND the job should show success and not failure because I am using continue-on-error
The text was updated successfully, but these errors were encountered: