Skip to content

Wrong behaviour when combining 'continue-on-error' and 'failure()' in subsequent steps #1034

Description

@jorgesolebur

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:

-name: Step 1  
continue-on-error: true. 
run:  'blabalbalba'  
-name: Step 2  
if: ${{ failure() }}  
run:  'bloblboblo'  

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions