Learn how you can create workflow templates to help people in your team add new workflows more easily.
Who can use this feature?Write access to the organization's public .github
repository. Templates can be used by organization members who have permission to create workflows.
Note
.github
repository, they are not available for Enterprise Managed Users.This procedure demonstrates how to create a workflow template and metadata file. The metadata file describes how the workflow templates 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@v4 - name: Run a one-line script run: echo Hello from Octo Organization
name: Octo Organization CI
on:
push:
branches: [ $default-branch ]
pull_request:
branches: [ $default-branch ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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 named octo-organization-ci.properties.json
contains the metadata for a workflow file named octo-organization-ci.yml
:
{ "name": "Octo Organization Workflow", "description": "Octo Organization CI workflow template.", "iconName": "example-icon", "categories": [ "Go" ], "filePatterns": [ "package.json$", "^Dockerfile", ".*\\.md$" ] }
{
"name": "Octo Organization Workflow",
"description": "Octo Organization CI workflow template.",
"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 is displayed in the list of workflows. iconName
can one of the following types:
workflow-templates
directory. To reference a file, the value must be the file name without the file extension. For example, an SVG file named example-icon.svg
is referenced as example-icon
.octicon <icon name>
. For example, octicon smiley
.categories
- Optional. Defines the categories that the workflow is shown under. You can use category names from the following lists:
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 workflow template, add your files to the same workflow-templates
directory.
To continue learning about GitHub Actions, see Using workflow templates.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4