Skip to content

Commit 3a05bf4

Browse files
committed
Split infrastructure shell commands into multiple lines for readability
The project's GitHub Actions workflows and tasks contain complex shell command lines. With the use of the line continuation operator, these commands can be split into multiple code lines. This improves readability by providing a visualization of the command structure. It also improves maintainability by making diffs for changes to these commands more clear.
1 parent b15ce6a commit 3a05bf4

8 files changed

+80
-20
lines changed

.github/workflows/check-general-formatting-task.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,19 @@ jobs:
7171
- name: Install editorconfig-checker
7272
run: |
7373
cd "${{ env.EC_INSTALL_PATH }}"
74-
tar --extract --file="${{ steps.download.outputs.name }}"
74+
tar \
75+
--extract \
76+
--file="${{ steps.download.outputs.name }}"
7577
# Give the binary a standard name
76-
mv "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" "${{ env.EC_INSTALL_PATH }}/bin/ec"
78+
mv \
79+
"${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" \
80+
"${{ env.EC_INSTALL_PATH }}/bin/ec"
7781
# Add installation to PATH:
7882
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
7983
echo "${{ env.EC_INSTALL_PATH }}/bin" >> "$GITHUB_PATH"
8084
8185
- name: Check formatting
82-
run: task --silent general:check-formatting
86+
run: |
87+
task \
88+
--silent \
89+
general:check-formatting

.github/workflows/check-go-dependencies-task.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,7 @@ jobs:
155155
version: 3.x
156156

157157
- name: Check for dependencies with unapproved licenses
158-
run: task --silent general:check-dep-licenses
158+
run: |
159+
task \
160+
--silent \
161+
general:check-dep-licenses

.github/workflows/check-go-task.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ jobs:
124124
run: task go:fix
125125

126126
- name: Check if any fixes were needed
127-
run: git diff --color --exit-code
127+
run: |
128+
git \
129+
diff \
130+
--color \
131+
--exit-code
128132
129133
check-style:
130134
name: check-style (${{ matrix.module.path }})
@@ -200,7 +204,11 @@ jobs:
200204
run: task go:format
201205

202206
- name: Check formatting
203-
run: git diff --color --exit-code
207+
run: |
208+
git \
209+
diff \
210+
--color \
211+
--exit-code
204212
205213
check-config:
206214
name: check-config (${{ matrix.module.path }})
@@ -231,4 +239,8 @@ jobs:
231239
run: go mod tidy
232240

233241
- name: Check whether any tidying was needed
234-
run: git diff --color --exit-code
242+
run: |
243+
git \
244+
diff \
245+
--color \
246+
--exit-code

.github/workflows/check-markdown-task.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,7 @@ jobs:
112112
version: 3.x
113113

114114
- name: Check links
115-
run: task --silent markdown:check-links
115+
run: |
116+
task \
117+
--silent \
118+
markdown:check-links

.github/workflows/check-prettier-formatting-task.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,13 @@ jobs:
252252
version: 3.x
253253

254254
- name: Format with Prettier
255-
run: task general:format-prettier
255+
run: |
256+
task \
257+
general:format-prettier
256258
257259
- name: Check formatting
258-
run: git diff --color --exit-code
260+
run: |
261+
git \
262+
diff \
263+
--color \
264+
--exit-code

.github/workflows/check-workflows-task.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,7 @@ jobs:
4545
version: 3.x
4646

4747
- name: Validate workflows
48-
run: task --silent ci:validate
48+
run: |
49+
task \
50+
--silent \
51+
ci:validate

.github/workflows/check-yaml-task.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,7 @@ jobs:
114114

115115
- name: Check YAML
116116
continue-on-error: ${{ matrix.configuration.continue-on-error }}
117-
run: task yaml:lint YAMLLINT_FORMAT=${{ matrix.configuration.format }}
117+
run: |
118+
task \
119+
yaml:lint \
120+
YAMLLINT_FORMAT=${{ matrix.configuration.format }}

Taskfile.yml

+31-8
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ tasks:
7474
cmds:
7575
- |
7676
if ! which ec &>/dev/null; then
77-
echo "ec not found or not in PATH. Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation"
77+
echo "ec not found or not in PATH."
78+
echo "Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation"
7879
exit 1
7980
fi
8081
- ec
@@ -85,7 +86,11 @@ tasks:
8586
deps:
8687
- task: npm:install-deps
8788
cmds:
88-
- npx prettier --write .
89+
- |
90+
npx \
91+
prettier \
92+
--write \
93+
.
8994
9095
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies-task/Taskfile.yml
9196
general:cache-dep-licenses:
@@ -97,7 +102,8 @@ tasks:
97102
echo "Licensed does not have Windows support."
98103
echo "Please use Linux/macOS or download the dependencies cache from the GitHub Actions workflow artifact."
99104
else
100-
echo "licensed not found or not in PATH. Please install: https://github.com/github/licensed#as-an-executable"
105+
echo "licensed not found or not in PATH."
106+
echo "Please install: https://github.com/github/licensed#as-an-executable"
101107
fi
102108
exit 1
103109
fi
@@ -117,15 +123,20 @@ tasks:
117123
deps:
118124
- task: poetry:install-deps
119125
cmds:
120-
- poetry run codespell
126+
- |
127+
poetry run \
128+
codespell
121129
122130
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
123131
general:correct-spelling:
124132
desc: Correct commonly misspelled words where possible
125133
deps:
126134
- task: poetry:install-deps
127135
cmds:
128-
- poetry run codespell --write-changes
136+
- |
137+
poetry run \
138+
codespell \
139+
--write-changes
129140
130141
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
131142
go:fix:
@@ -227,15 +238,22 @@ tasks:
227238
deps:
228239
- task: npm:install-deps
229240
cmds:
230-
- npx markdownlint-cli --fix "**/*.md"
241+
- |
242+
npx \
243+
markdownlint-cli \
244+
--fix \
245+
"**/*.md"
231246
232247
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
233248
markdown:lint:
234249
desc: Check for problems in Markdown files
235250
deps:
236251
- task: npm:install-deps
237252
cmds:
238-
- npx markdownlint-cli "**/*.md"
253+
- |
254+
npx \
255+
markdownlint-cli \
256+
"**/*.md"
239257
240258
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
241259
npm:install-deps:
@@ -376,4 +394,9 @@ tasks:
376394
deps:
377395
- task: poetry:install-deps
378396
cmds:
379-
- poetry run yamllint --format {{default "colored" .YAMLLINT_FORMAT}} .
397+
- |
398+
poetry run \
399+
yamllint \
400+
--format \
401+
{{default "colored" .YAMLLINT_FORMAT}} \
402+
.

0 commit comments

Comments
 (0)