Skip to content

Commit 7b5e425

Browse files
committed
use fewer "name" fields
I recently found out they aren't required, and for simple steps which can be stringified easily, they are rather pointless and verbose.
1 parent 7aaba8c commit 7b5e425

File tree

2 files changed

+15
-26
lines changed

2 files changed

+15
-26
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,19 @@ jobs:
88
os: [ubuntu-latest, macos-latest, windows-latest]
99
runs-on: ${{ matrix.os }}
1010
steps:
11-
- name: Install Go
12-
uses: actions/setup-go@v2
11+
- uses: actions/setup-go@v2
1312
with:
1413
go-version: ${{ matrix.go-version }}
15-
- name: Checkout code
16-
uses: actions/checkout@v2
17-
- name: Test
18-
run: go test ./...
14+
- uses: actions/checkout@v2
15+
- run: go test ./...
1916

2017
test-cache:
2118
runs-on: ubuntu-latest
2219
steps:
23-
- name: Install Go
24-
uses: actions/setup-go@v2
20+
- uses: actions/setup-go@v2
2521
with:
2622
go-version: 1.17.x
27-
- name: Checkout code
28-
uses: actions/checkout@v2
23+
- uses: actions/checkout@v2
2924
- uses: actions/cache@v2
3025
with:
3126
# In order:
@@ -41,5 +36,4 @@ jobs:
4136
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
4237
restore-keys: |
4338
${{ runner.os }}-go-
44-
- name: Test
45-
run: go test ./...
39+
- run: go test ./...

README.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@ jobs:
1717
os: [ubuntu-latest, macos-latest, windows-latest]
1818
runs-on: ${{ matrix.os }}
1919
steps:
20-
- name: Install Go
21-
uses: actions/setup-go@v2
20+
- uses: actions/setup-go@v2
2221
with:
2322
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 ./...
2825
```
2926
3027
## Summary
@@ -38,6 +35,8 @@ Go versions on three operating systems.
3835
Each job has a number of `steps`, such as installing Go, or checking out the
3936
repository's code.
4037

38+
Note that `name` fields are optional.
39+
4140
## FAQs
4241

4342
#### What about module support?
@@ -118,8 +117,7 @@ You can use `if` conditionals, using their [custom expression
118117
language](https://docs.github.com/en/actions/learn-github-actions/contexts):
119118

120119
```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'
123121
run: go run ./endtoend
124122
```
125123

@@ -153,8 +151,7 @@ to set up the secret in the repo's settings. After adding a secret like
153151
`FOO_SECRET`, use it on a step as follows:
154152

155153
```yaml
156-
- name: Command that requires secret
157-
run: some-command
154+
- run: some-command
158155
env:
159156
FOO_SECRET: ${{ secrets.FOO_SECRET }}
160157
```
@@ -186,8 +183,7 @@ jobs:
186183
Use `sudo apt`, making sure to only run the step on Linux:
187184

188185
```yaml
189-
- name: Install Linux packages
190-
if: matrix.os == 'ubuntu-latest'
186+
- if: matrix.os == 'ubuntu-latest'
191187
run: sudo apt update && sudo apt install -y --no-install-recommends mypackage
192188
```
193189

@@ -205,8 +201,7 @@ jobs:
205201
run:
206202
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
207203
steps:
208-
- name: Checkout code
209-
uses: actions/checkout@v2
204+
- uses: actions/checkout@v2
210205
with:
211206
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
212207
```

0 commit comments

Comments
 (0)