Note: GitHub-hosted runners are not currently supported on GitHub Enterprise Server. You can see more information about planned future support on the GitHub public roadmap.
Overview
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.
GitHub provides ready-to-use starter workflows for the following high level categories:
-
Deployment (CD). For more information, see "About continuous deployment."
-
Continuous Integration (CI). For more information, see "About continuous integration."
-
Automation. Automation starter workflows offer solutions for automating workflows, such as triaging pull requests and applying a label based on the paths that are modified in the pull request, or greeting users who are first time contributors to the repository.
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.
-
If it doesn't already exist, create a new public repository named
.github
in your organization. -
Create a directory named
workflow-templates
. -
Create your new workflow file inside the
workflow-templates
directory.If you need to refer to a repository's default branch, you can use the
$default-branch
placeholder. When a workflow is created the placeholder will be automatically replaced with the name of the repository's default branch.For example, this file named
octo-organization-ci.yml
demonstrates a basic workflow.name: Octo Organization CI on: push: branches: [ $default-branch ] pull_request: branches: [ $default-branch ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Run a one-line script run: echo Hello from Octo Organization
-
Create a metadata file inside the
workflow-templates
directory. The metadata file must have the same name as the workflow file, but instead of the.yml
extension, it must be appended with.properties.json
. For example, this file namedocto-organization-ci.properties.json
contains the metadata for a workflow file namedocto-organization-ci.yml
:{ "name": "Octo Organization Workflow", "description": "Octo Organization CI starter workflow.", "iconName": "example-icon", "categories": [ "Go" ], "filePatterns": [ "package.json$", "^Dockerfile", ".*\\.md$" ] }
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. TheiconName
must be the name of an SVG file, without the file name extension, stored in theworkflow-templates
directory. For example, an SVG file namedexample-icon.svg
is referenced asexample-icon
.categories
- Optional. Defines the language category of the workflow. 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. For information on the available language categories, see https://github.com/github/linguist/blob/master/lib/linguist/languages.yml.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. For example:
Next steps
To continue learning about GitHub Actions, see "Using starter workflows."