Skip to main content

Disabling and enabling a workflow

You can disable and re-enable a workflow using the GitHub UI, the REST API, or GitHub CLI.

Tool navigation

注意

GitHub Enterprise Server 目前不支持 GitHub 托管的运行器。 可以在 GitHub public roadmap 上查看有关未来支持计划的更多信息。

Disabling a workflow allows you to stop a workflow from being triggered without having to delete the file from the repo. You can easily re-enable the workflow again on GitHub.

Temporarily disabling a workflow can be useful in many scenarios. These are a few examples where disabling a workflow might be helpful:

  • A workflow error that produces too many or wrong requests, impacting external services negatively.
  • A workflow that is not critical and is consuming too many minutes on your account.
  • A workflow that sends requests to a service that is down.
  • Workflows on a forked repository that aren't needed (for example, scheduled workflows).

警告

为防止不必要的工作流程运行,可能会自动禁用计划的工作流程。 在复刻公共仓库时,默认情况下将禁用计划的工作流程。 在公共仓库中,当 60 天内未发生仓库活动时,将自动禁用计划的工作流程。

You can also disable and enable a workflow using the REST API. For more information, see 工作流的 REST API 终结点.

Disabling a workflow

  1. 在 GitHub 上,导航到存储库的主页面。

  2. 在存储库名称下,单击 “操作”。

    “github/docs”存储库的选项卡的屏幕截图。 “操作”选项卡以橙色边框突出显示。

  3. In the left sidebar, click the workflow you want to disable.

  4. Click to display a dropdown menu and click Disable workflow.

    Screenshot of a workflow. The "Show workflow options" button, shown with a kebab icon, and the "Disable workflow" menu item are outlined in orange.

注意

若要详细了解 GitHub CLI,请参阅“关于 GitHub CLI”。

To disable a workflow, use the workflow disable subcommand. Replace workflow with either the name, ID, or file name of the workflow you want to disable. For example, "Link Checker", 1234567, or "link-check-test.yml". If you don't specify a workflow, GitHub CLI returns an interactive menu for you to choose a workflow.

gh workflow disable WORKFLOW

Enabling a workflow

You can re-enable a workflow that was previously disabled.

  1. 在 GitHub 上,导航到存储库的主页面。

  2. 在存储库名称下,单击 “操作”。

    “github/docs”存储库的选项卡的屏幕截图。 “操作”选项卡以橙色边框突出显示。

  3. In the left sidebar, click the workflow you want to enable.

    Screenshot of the "Actions" page. In the left sidebar, a workflow name is highlighted with an outline in dark orange.

  4. Click Enable workflow.

To enable a workflow, use the workflow enable subcommand. Replace workflow with either the name, ID, or file name of the workflow you want to enable. For example, "Link Checker", 1234567, or "link-check-test.yml". If you don't specify a workflow, GitHub CLI returns an interactive menu for you to choose a workflow.

gh workflow enable WORKFLOW