- If a job fails, the whole workflow fails.
- If a step fails, the whole job fails.
- If a job is cancelled, the whole workflow is cancelled.
- If a step is cancelled, the whole job is cancelled.
- Every job/step can succeed/fail/cancel.
- The downstream jobs (with
needs
keyword) or following steps might decide to run, even when the previous jobs/steps have failed/cancelled, using theif
keyword (but this won't change the status of the parent workflow/job):- always()
- cancelled()
- failure()
- success() <- this is the default
- By default (
if: success()
) steps/jobs following a failure/cancel will be skipped. - There's only one way to change the status of a job/step, this is using the
continue-on-error
keyword. This will "capture" failures and continue just as if it were a success. - Reusable workflows cannot use
continue-on-error
from "outside", the reusable workflow should declare it from "inside". - Whenever a workflow is cancelled, every step is cancelled at the same time. This will thus also cancel every running job.
- Steps that are running during cancel will be stopped unless they explicitly have the condition to run with cancel (
if: always()/cancelled()
). - Steps will run for a maximum of 5 minutes after the workflow has been cancelled.
- It's impossible to revert a cancel (there's no
continue-on-error
equivalent).
Created
November 7, 2023 17:47
-
-
Save aserrallerios/cc2f186656250d00a2bd4dc6e58d740e to your computer and use it in GitHub Desktop.
GHA error handling
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment