Skip to content

Commit e81ef29

Browse files
committed
ci: Simplify shell configuration by setting defaults
1 parent b597e01 commit e81ef29

File tree

4 files changed

+29
-21
lines changed

4 files changed

+29
-21
lines changed

.github/workflows/checks.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ permissions:
2222
jobs:
2323
unit-test:
2424
runs-on: ubuntu-22.04
25+
defaults:
26+
run:
27+
shell: bash
2528
steps:
2629
- name: Check out code
2730
uses: actions/checkout@v4
@@ -32,7 +35,6 @@ jobs:
3235
enable-cache: true
3336

3437
- name: Run unit tests
35-
shell: bash
3638
run: devbox run -- make test
3739

3840
- name: Annotate tests
@@ -43,6 +45,9 @@ jobs:
4345

4446
e2e-test:
4547
runs-on: ubuntu-22.04
48+
defaults:
49+
run:
50+
shell: bash
4651
steps:
4752
- name: Check out code
4853
uses: actions/checkout@v4
@@ -61,25 +66,25 @@ jobs:
6166

6267
- if: steps.check_e2e_tests_exist.outputs.files_exists == 'true'
6368
name: Build and install on KinD
64-
shell: bash
6569
run: devbox run -- make dev.run-on-kind
6670
env:
6771
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6872

6973
- if: steps.check_e2e_tests_exist.outputs.files_exists == 'true'
7074
name: Run e2e tests
71-
shell: bash
7275
run: devbox run -- make e2e-test
7376
env:
7477
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7578

7679
- if: steps.check_e2e_tests_exist.outputs.files_exists == 'true' && always()
7780
name: Cleanup KinD cluster
78-
shell: bash
7981
run: devbox run -- make kind.delete
8082

8183
lint-go:
8284
runs-on: ubuntu-22.04
85+
defaults:
86+
run:
87+
shell: bash
8388
steps:
8489
- name: Check out code
8590
uses: actions/checkout@v4
@@ -91,7 +96,6 @@ jobs:
9196

9297
- name: Export golang and golangci-lint versions
9398
id: versions
94-
shell: bash
9599
run: |
96100
echo "golangci-lint=$(devbox run -- golangci-lint version --format short)" >>"${GITHUB_OUTPUT}"
97101
echo "golang=$(devbox run -- go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>"${GITHUB_OUTPUT}"
@@ -130,6 +134,9 @@ jobs:
130134

131135
pre-commit:
132136
runs-on: ubuntu-22.04
137+
defaults:
138+
run:
139+
shell: bash
133140
steps:
134141
- name: Check out code
135142
uses: actions/checkout@v4
@@ -148,13 +155,15 @@ jobs:
148155
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
149156

150157
- name: Run pre-commit
151-
shell: bash
152158
run: devbox run -- make pre-commit
153159
env:
154160
SKIP: no-commit-to-branch,golangci-lint,actionlint-system
155161

156162
lint-test-helm:
157163
runs-on: ubuntu-22.04
164+
defaults:
165+
run:
166+
shell: bash
158167
steps:
159168
- name: Checkout
160169
uses: actions/checkout@v4
@@ -168,7 +177,6 @@ jobs:
168177

169178
- name: Run chart-testing (list-changed)
170179
id: list-changed
171-
shell: bash
172180
run: |
173181
changed="$(devbox run -- \
174182
ct list-changed --config charts/ct-config.yaml \
@@ -179,14 +187,12 @@ jobs:
179187
180188
- if: steps.list-changed.outputs.changed == 'true'
181189
name: Run chart-testing (lint)
182-
shell: bash
183190
run: |
184191
devbox run -- \
185192
ct lint --config charts/ct-config.yaml
186193
187194
- if: steps.list-changed.outputs.changed == 'true'
188195
name: Create kind cluster
189-
shell: bash
190196
run: |
191197
devbox run -- \
192198
kind create cluster \
@@ -197,14 +203,12 @@ jobs:
197203

198204
- if: steps.list-changed.outputs.changed == 'true'
199205
name: Build Docker images
200-
shell: bash
201206
run: |
202207
devbox run -- \
203208
make release-snapshot
204209
205210
- if: steps.list-changed.outputs.changed == 'true'
206211
name: Sideload docker image
207-
shell: bash
208212
run: |
209213
devbox run -- \
210214
kind load docker-image \
@@ -213,7 +217,6 @@ jobs:
213217
214218
- if: steps.list-changed.outputs.changed == 'true'
215219
name: Setup Cluster API and cert-manager
216-
shell: bash
217220
run: |
218221
devbox run -- \
219222
make clusterctl.init
@@ -222,7 +225,6 @@ jobs:
222225

223226
- if: steps.list-changed.outputs.changed == 'true'
224227
name: Run chart-testing (install)
225-
shell: bash
226228
run: |
227229
devbox run -- \
228230
ct install \
@@ -233,7 +235,6 @@ jobs:
233235

234236
- if: steps.list-changed.outputs.changed == 'true' && always()
235237
name: Delete chart-testing KinD cluster
236-
shell: bash
237238
run: |
238239
devbox run -- \
239240
kind delete cluster --name chart-testing || true

.github/workflows/dependabot-automation.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ permissions:
1414

1515
jobs:
1616
auto-approve:
17-
runs-on: ubuntu-22.04
1817
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
18+
runs-on: ubuntu-22.04
19+
defaults:
20+
run:
21+
shell: bash
1922
steps:
2023
- name: Dependabot metadata
2124
id: dependabot-metadata
2225
uses: dependabot/fetch-metadata@v1
2326
- uses: actions/checkout@v4
2427
- name: Approve a PR if not already approved
25-
shell: bash
2628
run: |
2729
gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status`
2830
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; then
@@ -35,14 +37,16 @@ jobs:
3537
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
3638

3739
enable-automerge:
38-
runs-on: ubuntu-22.04
3940
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]'}}
41+
runs-on: ubuntu-22.04
42+
defaults:
43+
run:
44+
shell: bash
4045
steps:
4146
- name: Dependabot metadata
4247
id: dependabot-metadata
4348
uses: dependabot/fetch-metadata@v1
4449
- name: Enable auto-merge for Dependabot PRs
45-
shell: bash
4650
run: gh pr merge --auto --squash "$PR_URL"
4751
env:
4852
PR_URL: ${{github.event.pull_request.html_url}}

.github/workflows/github-pages.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
jobs:
1313
deploy:
1414
runs-on: ubuntu-22.04
15+
defaults:
16+
run:
17+
shell: bash
1518
permissions:
1619
contents: write
1720
concurrency:
@@ -36,12 +39,10 @@ jobs:
3639
cache-dependency-path: '**/package-lock.json'
3740

3841
- name: Install necessary packages
39-
shell: bash
4042
run: npm ci
4143
working-directory: ./docs/
4244

4345
- name: Build
44-
shell: bash
4546
run: hugo --minify
4647
working-directory: ./docs/
4748

.github/workflows/release-tag.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ permissions:
1616
jobs:
1717
release-tag:
1818
runs-on: ubuntu-22.04
19+
defaults:
20+
run:
21+
shell: bash
1922
steps:
2023
- uses: actions/checkout@v4
2124
with:
@@ -35,7 +38,6 @@ jobs:
3538
password: ${{ secrets.GITHUB_TOKEN }}
3639

3740
- name: Release
38-
shell: bash
3941
run: devbox run -- make release
4042
env:
4143
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)