You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/actions/how-tos/reuse-automations/create-workflow-templates.md
+41-1Lines changed: 41 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,47 @@ This procedure demonstrates how to create a workflow template and metadata file.
28
28
1. If it doesn't already exist, create a new repository named `.github` in your organization.
29
29
1. Create a directory named `workflow-templates`.
30
30
1. Create your new workflow file inside the `workflow-templates` directory.
31
-
1. Create a metadata file inside the `workflow-templates` directory.
31
+
32
+
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.
33
+
34
+
{% ifversion ghes %}
35
+
36
+
> [!NOTE]
37
+
> The following values in the `runs-on` key are also treated as placeholders:
38
+
>
39
+
> *`ubuntu-latest` is replaced with `[ self-hosted ]`
40
+
> *`windows-latest` is replaced with `[ self-hosted, windows ]`
41
+
> *`macos-latest` is replaced with `[ self-hosted, macOS ]`
42
+
{% endif %}
43
+
44
+
For example, this file named `octo-organization-ci.yml` demonstrates a basic workflow.
45
+
46
+
```yaml copy
47
+
name: Octo Organization CI
48
+
49
+
on:
50
+
push:
51
+
branches: [ $default-branch ]
52
+
pull_request:
53
+
branches: [ $default-branch ]
54
+
55
+
jobs:
56
+
build:
57
+
runs-on: ubuntu-latest
58
+
59
+
steps:
60
+
- uses: {% data reusables.actions.action-checkout %}
61
+
62
+
- name: Run a one-line script
63
+
run: echo Hello from Octo Organization
64
+
```
65
+
66
+
1. 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`:
67
+
68
+
{% data reusables.actions.workflow-templates-metadata-example %}
69
+
70
+
{% data reusables.actions.workflow-templates-metadata-keys %}
71
+
32
72
1. To add another workflow template, add your files to the same `workflow-templates` directory.
Copy file name to clipboardExpand all lines: content/actions/reference/workflows-and-actions/reusing-workflow-configurations.md
+3-27Lines changed: 3 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,33 +170,9 @@ jobs:
170
170
171
171
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`:
172
172
173
-
```json copy
174
-
{
175
-
"name": "Octo Organization Workflow",
176
-
"description": "Octo Organization CI workflow template.",
177
-
"iconName": "example-icon",
178
-
"categories": [
179
-
"Go"
180
-
],
181
-
"filePatterns": [
182
-
"package.json$",
183
-
"^Dockerfile",
184
-
".*\\.md$"
185
-
]
186
-
}
187
-
```
188
-
189
-
* `name` - **Required.** The name of the workflow. This is displayed in the list of available workflows.
190
-
* `description` - **Required.** The description of the workflow. This is displayed in the list of available workflows.
191
-
* `iconName` - _Optional._ Specifies an icon for the workflow that is displayed in the list of workflows. `iconName` can one of the following types:
192
-
* An SVG file that is stored in the `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`.
193
-
* An icon from {% data variables.product.prodname_dotcom %}'s set of [Octicons](https://primer.style/octicons/). To reference an octicon, the value must be `octicon <icon name>`. For example, `octicon smiley`.
194
-
* `categories` - **Optional.** Defines the categories that the workflow is shown under. You can use category names from the following lists:
195
-
* General category names from the [starter-workflows](https://github.com/actions/starter-workflows/blob/main/README.md#categories) repository.
196
-
* Linguist languages from the list in the [linguist](https://github.com/github-linguist/linguist/blob/main/lib/linguist/languages.yml) repository.
197
-
* Supported tech stacks from the list in the [starter-workflows](https://github.com/github-starter-workflows/repo-analysis-partner/blob/main/tech_stacks.yml) repository.
198
-
199
-
* `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.
173
+
{% data reusables.actions.workflow-templates-metadata-example %}
174
+
175
+
{% data reusables.actions.workflow-templates-metadata-keys %}
*`name` - **Required.** The name of the workflow. This is displayed in the list of available workflows.
2
+
*`description` - **Required.** The description of the workflow. This is displayed in the list of available workflows.
3
+
*`iconName` - **Optional.** Specifies an icon for the workflow that is displayed in the list of workflows. `iconName` can be one of the following types:
4
+
* An SVG file that is stored in the `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`.
5
+
* An icon from {% data variables.product.prodname_dotcom %}'s set of [Octicons](https://primer.style/octicons/). To reference an octicon, the value must be `octicon <icon name>`. For example, `octicon smiley`.
6
+
*`categories` - **Optional.** Defines the categories that the workflow is shown under. You can use category names from the following lists:
7
+
* General category names from the [starter-workflows](https://github.com/actions/starter-workflows/blob/main/README.md#categories) repository.
8
+
* Linguist languages from the list in the [linguist](https://github.com/github-linguist/linguist/blob/main/lib/linguist/languages.yml) repository.
9
+
* Supported tech stacks from the list in the [starter-workflows](https://github.com/github-starter-workflows/repo-analysis-partner/blob/main/tech_stacks.yml) repository.
10
+
11
+
*`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.
0 commit comments