3.1 KiB
title, shortTitle, intro, redirect_from, versions, type, topics
| title | shortTitle | intro | redirect_from | versions | type | topics | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Creating workflow templates for your organization | Create workflow templates | Learn how you can create workflow templates to help people in your team add new workflows more easily. |
|
|
tutorial |
|
{% data reusables.actions.enterprise-github-hosted-runners %}
Creating workflow templates
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 repository named
.githubin your organization. -
Create a directory named
workflow-templates. -
Create your new workflow file inside the
workflow-templatesdirectory.If you need to refer to a repository's default branch, you can use the
$default-branchplaceholder. When a workflow is created the placeholder will be automatically replaced with the name of the repository's default branch.{% ifversion ghes %}
Note
The following values in the
runs-onkey are also treated as placeholders:ubuntu-latestis replaced with[ self-hosted ]windows-latestis replaced with[ self-hosted, windows ]macos-latestis replaced with[ self-hosted, macOS ]{% endif %}
For example, this file named
octo-organization-ci.ymldemonstrates 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: {% data reusables.actions.action-checkout %} - name: Run a one-line script run: echo Hello from Octo Organization -
Create a metadata file inside the
workflow-templatesdirectory. The metadata file must have the same name as the workflow file, but instead of the.ymlextension, it must be appended with.properties.json. For example, this file namedocto-organization-ci.properties.jsoncontains the metadata for a workflow file namedocto-organization-ci.yml:{% data reusables.actions.workflow-templates-metadata-example %}
{% data reusables.actions.workflow-templates-metadata-keys %}
-
To add another workflow template, add your files to the same
workflow-templatesdirectory.
Next steps
- For reference information about workflow templates, see AUTOTITLE.