@@ -17,14 +17,11 @@ jobs:
17
17
os : [ubuntu-latest, macos-latest, windows-latest]
18
18
runs-on : ${{ matrix.os }}
19
19
steps :
20
- - name : Install Go
21
- uses : actions/setup-go@v2
20
+ - uses : actions/setup-go@v2
22
21
with :
23
22
go-version : ${{ matrix.go-version }}
24
- - name : Checkout code
25
- uses : actions/checkout@v2
26
- - name : Test
27
- run : go test ./...
23
+ - uses : actions/checkout@v2
24
+ - run : go test ./...
28
25
` ` `
29
26
30
27
## Summary
@@ -38,6 +35,8 @@ Go versions on three operating systems.
38
35
Each job has a number of `steps`, such as installing Go, or checking out the
39
36
repository's code.
40
37
38
+ Note that `name` fields are optional.
39
+
41
40
# # FAQs
42
41
43
42
# ### What about module support?
@@ -118,8 +117,7 @@ You can use `if` conditionals, using their [custom expression
118
117
language](https://docs.github.com/en/actions/learn-github-actions/contexts) :
119
118
120
119
` ` ` yaml
121
- - name: Run end-to-end tests on Linux
122
- if: github.event_name == 'push' && matrix.os == 'ubuntu-latest'
120
+ - if: github.event_name == 'push' && matrix.os == 'ubuntu-latest'
123
121
run: go run ./endtoend
124
122
` ` `
125
123
@@ -153,8 +151,7 @@ to set up the secret in the repo's settings. After adding a secret like
153
151
`FOO_SECRET`, use it on a step as follows :
154
152
155
153
` ` ` yaml
156
- - name: Command that requires secret
157
- run: some-command
154
+ - run: some-command
158
155
env:
159
156
FOO_SECRET: ${{ secrets.FOO_SECRET }}
160
157
` ` `
@@ -186,8 +183,7 @@ jobs:
186
183
Use `sudo apt`, making sure to only run the step on Linux :
187
184
188
185
` ` ` yaml
189
- - name: Install Linux packages
190
- if: matrix.os == 'ubuntu-latest'
186
+ - if: matrix.os == 'ubuntu-latest'
191
187
run: sudo apt update && sudo apt install -y --no-install-recommends mypackage
192
188
` ` `
193
189
@@ -205,8 +201,7 @@ jobs:
205
201
run:
206
202
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
207
203
steps:
208
- - name: Checkout code
209
- uses: actions/checkout@v2
204
+ - uses: actions/checkout@v2
210
205
with:
211
206
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
212
207
` ` `
0 commit comments