2.7 KiB
2.7 KiB
title, shortTitle, intro, versions
| title | shortTitle | intro | versions | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Canceling a workflow | Cancel a workflow | You can cancel a workflow run that is in progress. When you cancel a workflow run, {% data variables.product.prodname_dotcom %} cancels all jobs and steps that are a part of that workflow. |
|
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.repositories.permissions-statement-write %}
Canceling a workflow run
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %}
- From the list of workflow runs, click the name of the
queuedorin progressrun that you want to cancel. - In the upper-right corner of the workflow, click Cancel workflow.

Steps {% data variables.product.prodname_dotcom %} takes to cancel a workflow run
When canceling workflow run, you may be running other software that uses resources that are related to the workflow run. To help you free up resources related to the workflow run, it may help to understand the steps {% data variables.product.prodname_dotcom %} performs to cancel a workflow run.
- To cancel the workflow run, the server re-evaluates
ifconditions for all currently running jobs. If the condition evaluates totrue, the job will not get canceled. For example, the conditionif: always()would evaluate to true and the job continues to run. When there is no condition, that is the equivalent of the conditionif: success(), which only runs if the previous step finished successfully. - For jobs that need to be canceled, the server sends a cancellation message to all the runner machines with jobs that need to be canceled.
- For jobs that continue to run, the server re-evaluates
ifconditions for the unfinished steps. If the condition evaluates totrue, the step continues to run. - For steps that need to be canceled, the runner machine sends
SIGINT/Ctrl-Cto the step's entry process (nodefor javascript action,dockerfor container action, andbash/cmd/pwdwhen usingrunin a step). If the process doesn't exit within 7500 ms, the runner will sendSIGTERM/Ctrl-Breakto the process, then wait for 2500 ms for the process to exit. If the process is still running, the runner kills the process tree. - After the 5 minutes cancellation timeout period, the server will force terminate all jobs and steps that don't finish running or fail to complete the cancellation process.