About workflows
工作流是一个可配置的自动化过程,它将运行一个或多个作业。 工作流程由签入到存储库的 YAML 文件定义,并在存储库中的事件触发时运行,也可以手动触发,或按定义的时间表触发。
工作流在仓库的 .github/workflows
目录中定义。 一个仓库可以有多个工作流,每个工作流都可以执行一组不同的任务,例如:
- 构建和测试拉取请求
- 在每次创建发布时,部署应用程序
- 每当创建新提议时,添加标签
Workflow basics
A workflow must contain the following basic components:
- One or more events that will trigger the workflow.
- One or more jobs, each of which will execute on a runner machine and run a series of one or more steps.
- Each step can either run a script that you define or run an action, which is a reusable extension that can simplify your workflow.
For more information on these basic components, see Understanding GitHub Actions.
Workflow triggers
工作流程触发器是导致工作流程运行的事件。 这些事件可以是:
- 工作流程存储库中发生的事件
- 在 GitHub 外部发生并在 GitHub 上触发
repository_dispatch
事件的事件 - 预定时间
- 手动
例如,您可以将工作流程配置为在推送到存储库的默认分支、创建发行版或打开议题时运行。
For more information, see 触发工作流程.
Next steps
To build your first workflow, see Creating an example workflow.