Creating starter workflows for your organization

Learn how you can create starter workflows to help people in your team add new workflows more easily.

注: GitHub 托管的运行器目前在 GitHub Enterprise Server 上不受支持。 您可以在 GitHub 公共路线图 上查看有关未来支持计划的更多信息。


Starter workflows allow everyone in your organization who has permission to create workflows to do so more quickly and easily. When you create a new workflow, you can choose a starter workflow and some or all of the work of writing the workflow will be done for you. You can use starter workflows as a starting place to build your custom workflow or use them as-is. This not only saves time, it promotes consistency and best practice across your organization.

Creating a starter workflow

Starter workflows can be created by users with write access to the organization's .github repository. These can then be used by organization members who have permission to create workflows.

This procedure demonstrates how to create a starter workflow and metadata file. The metadata file describes how the starter workflows will be presented to users when they are creating a new workflow.

  1. 如果组织中没有名为 .github 的公共仓库,请新建一个。

  2. 创建一个名为 workflow-templates 的目录。

  3. workflow-templates 目录中创建新的工作流程文件。

    如果需要引用仓库的默认分支,可以使用 $default-branch 占位符。 When a workflow is created the placeholder will be automatically replaced with the name of the repository's default branch.

    例如,下面这个名为 octo-organization-ci.yml 的文件展示了一个基本的工作流程。

    name: Octo Organization CI
        branches: [ $default-branch ]
        branches: [ $default-branch ]
        runs-on: ubuntu-latest
          - uses: actions/checkout@v2
          - name: Run a one-line script
            run: echo Hello from Octo Organization
  4. workflow-templates 目录中创建元数据文件。 元数据文件必须与工作流程文件同名,但扩展名不是 .yml,而必须附加 .properties.json。 例如,下面这个名为 的文件包含名为 octo-organization-ci.yml 的工作流程文件的元数据:

        "name": "Octo Organization Workflow",
        "description": "Octo Organization CI starter workflow.",
        "iconName": "example-icon",
        "categories": [
        "filePatterns": [
    • name - Required. The name of the workflow. This is displayed in the list of available workflows.
    • description - Required. The description of the workflow. This is displayed in the list of available workflows.
    • iconName - Optional. Specifies an icon for the workflow that's displayed in the list of workflows. The iconName must be the name of an SVG file, without the file name extension, stored in the workflow-templates directory. For example, an SVG file named example-icon.svg is referenced as example-icon.
    • categories - 可选。定义工作流程的语言类别。 When a user views the available starter workflows for a repository, the workflows that match the identified language for the project are featured more prominently. 有关可用语言类别的信息,请参阅。
    • filePatterns - Optional. Allows the workflow to be used if the user's repository has a file in its root directory that matches a defined regular expression.

To add another starter workflow, add your files to the same workflow-templates directory. 例如:

Workflow files


To continue learning about GitHub Actions, see "Using starter workflows."




所有 GitHub 文档都是开源的。看到错误或不清楚的内容了吗?提交拉取请求。


或者, 了解如何参与。