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
@@ -33,149 +33,44 @@ Your new {% data variables.product.prodname_actions %} workflow file is now inst
33
33
34
34
To help you understand how YAML syntax is used to create a workflow file, this section explains each line of the introduction's example:
35
35
36
-
<table>
37
-
<tr>
38
-
<th scope="col">Code</th>
39
-
<th scope="col">Explanation</th>
40
-
</tr>
41
-
<tr>
42
-
<td>
43
-
44
-
```yaml
45
-
name: learn-github-actions
46
-
```
47
-
48
-
</td>
49
-
<td>
50
-
<em>Optional</em> - The name of the workflow as it will appear in the "Actions" tab of the {% data variables.product.prodname_dotcom %} repository.
51
-
</td>
52
-
</tr>
53
-
{%- ifversion actions-run-name %}
54
-
<tr>
55
-
<td>
36
+
```yaml annotate copy
37
+
# Optional - The name of the workflow as it will appear in the "Actions" tab of the {% data variables.product.prodname_dotcom %} repository. If this field is omitted, the name of the workflow file will be used instead.
38
+
name: learn-github-actions
56
39
57
-
```yaml
58
-
run-name: {% raw %}${{ github.actor }}{% endraw %} is learning GitHub Actions
59
-
```
40
+
{%- ifversion actions-run-name %}
41
+
# Optional - The name for workflow runs generated from the workflow, which will appear in the list of workflow runs on your repository's "Actions" tab. This example uses an expression with the `github` context to display the username of the actor that triggered the workflow run. For more information, see "[AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#run-name)."
42
+
run-name: {% raw %}${{ github.actor }}{% endraw %} is learning GitHub Actions
43
+
{%- endif %}
60
44
61
-
</td>
62
-
<td>
45
+
# Specifies the trigger for this workflow. This example uses the `push` event, so a workflow run is triggered every time someone pushes a change to the repository or merges a pull request. This is triggered by a push to every branch; for examples of syntax that runs only on pushes to specific branches, paths, or tags, see "[AUTOTITLE](/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore)."
46
+
on: [push]
63
47
64
-
<em>Optional</em> - The name for workflow runs generated from the workflow, which will appear in the list of workflow runs on your repository's "Actions" tab. This example uses an expression with the `github` context to display the username of the actor that triggered the workflow run. For more information, see "[AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#run-name)."
65
-
</td>
66
-
</tr>
67
-
{%- endif %}
68
-
<tr>
69
-
<td>
70
-
71
-
```yaml
72
-
on: [push]
73
-
```
74
-
75
-
</td>
76
-
<td>
77
-
Specifies the trigger for this workflow. This example uses the <code>push</code> event, so a workflow run is triggered every time someone pushes a change to the repository or merges a pull request. This is triggered by a push to every branch; for examples of syntax that runs only on pushes to specific branches, paths, or tags, see "<a href="/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore">Workflow syntax for {% data variables.product.prodname_actions %}</a>."
78
-
</td>
79
-
</tr>
80
-
<tr>
81
-
<td>
82
-
83
-
```yaml
48
+
# Groups together all the jobs that run in the `learn-github-actions` workflow.
84
49
jobs:
85
-
```
86
-
87
-
</td>
88
-
<td>
89
-
Groups together all the jobs that run in the <code>learn-github-actions</code> workflow.
90
-
</td>
91
-
</tr>
92
-
<tr>
93
-
<td>
94
50
95
-
```yaml
51
+
# Defines a job named `check-bats-version`. The child keys will define properties of the job.
96
52
check-bats-version:
97
-
```
98
-
99
-
</td>
100
-
<td>
101
-
Defines a job named <code>check-bats-version</code>. The child keys will define properties of the job.
102
-
</td>
103
-
</tr>
104
-
<tr>
105
-
<td>
106
53
107
-
```yaml
54
+
# Configures the job to run on the latest version of an Ubuntu Linux runner. This means that the job will execute on a fresh virtual machine hosted by GitHub. For syntax examples using other runners, see "[AUTOTITLE](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)"
108
55
runs-on: ubuntu-latest
109
-
```
110
56
111
-
</td>
112
-
<td>
113
-
Configures the job to run on the latest version of an Ubuntu Linux runner. This means that the job will execute on a fresh virtual machine hosted by GitHub. For syntax examples using other runners, see "<a href="/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on">Workflow syntax for {% data variables.product.prodname_actions %}</a>."
114
-
</td>
115
-
</tr>
116
-
<tr>
117
-
<td>
118
-
119
-
```yaml
57
+
# Groups together all the steps that run in the `check-bats-version` job. Each item nested under this section is a separate action or shell script.
120
58
steps:
121
-
```
122
-
123
-
</td>
124
-
<td>
125
-
Groups together all the steps that run in the <code>check-bats-version</code> job. Each item nested under this section is a separate action or shell script.
126
-
</td>
127
-
</tr>
128
-
<tr>
129
-
<td>
130
59
131
-
```yaml
60
+
# The `uses` keyword specifies that this step will run `v3` of the `actions/checkout` action. This is an action that checks out your repository onto the runner, allowing you to run scripts or other actions against your code (such as build and test tools). You should use the checkout action any time your workflow will use the repository's code.
132
61
- uses: {% data reusables.actions.action-checkout %}
133
-
```
134
-
135
-
</td>
136
-
<td>
137
-
The <code>uses</code> keyword specifies that this step will run <code>v3</code> of the <code>actions/checkout</code> action. This is an action that checks out your repository onto the runner, allowing you to run scripts or other actions against your code (such as build and test tools). You should use the checkout action any time your workflow will run against the repository's code.
138
-
</td>
139
-
</tr>
140
-
<tr>
141
-
<td>
142
62
143
-
```yaml
63
+
# This step uses the `{% data reusables.actions.action-setup-node %}` action to install the specified version of the Node.js. (This example uses version 14.) This puts both the `node` and `npm` commands in your `PATH`.
144
64
- uses: {% data reusables.actions.action-setup-node %}
145
65
with:
146
66
node-version: '14'
147
-
```
148
67
149
-
</td>
150
-
<td>
151
-
This step uses the <code>{% data reusables.actions.action-setup-node %}</code> action to install the specified version of the Node.js (this example uses v14). This puts both the <code>node</code> and <code>npm</code> commands in your <code>PATH</code>.
152
-
</td>
153
-
</tr>
154
-
<tr>
155
-
<td>
156
-
157
-
```yaml
68
+
# The `run` keyword tells the job to execute a command on the runner. In this case, you are using `npm` to install the `bats` software testing package.
158
69
- run: npm install -g bats
159
-
```
160
-
161
-
</td>
162
-
<td>
163
-
The <code>run</code> keyword tells the job to execute a command on the runner. In this case, you are using <code>npm</code> to install the <code>bats</code> software testing package.
164
-
</td>
165
-
</tr>
166
-
<tr>
167
-
<td>
168
70
169
-
```yaml
71
+
# Finally, you'll run the `bats` command with a parameter that outputs the software version.
170
72
- run: bats -v
171
-
```
172
-
173
-
</td>
174
-
<td>
175
-
Finally, you'll run the <code>bats</code> command with a parameter that outputs the software version.
0 commit comments