I have the following workflow outline
jobs:
job1:
steps:
- name: step 1 of job 1
run: exit 1
job2:
if: failure()
steps:
- name: step 1 of job 2
run: echo "Hello World"
I know the above runs. However it marks my corresponding status check as failed (red color). Is there a way to make the action execution successful?
CodePudding user response:
You could use the continue-on-error step option:
jobs.<job_id>.steps[*].continue-on-error
Prevents a job from failing when a step fails. Set to true to allow a job to pass when this step fails
You. could check the outcome
of the step in order to understand if was failed or not like:
steps.<id>.outcome != 'success'
See outcome doc here