Skip to content

Commit d7ccd4a

Browse files
committed
workflows: use set -xeuo pipefail globally
This is the same change as Homebrew/brew#18369.
1 parent 41d21e0 commit d7ccd4a

18 files changed

+77
-27
lines changed

.github/workflows/actionlint.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
paths:
1111
- '.github/workflows/*.ya?ml'
1212

13+
defaults:
14+
run:
15+
shell: bash -xeuo pipefail {0}
16+
1317
concurrency:
1418
group: "actionlint-${{ github.ref }}"
1519
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
@@ -35,7 +39,6 @@ jobs:
3539
test-bot: false
3640

3741
- name: Set up actionlint
38-
shell: bash
3942
env:
4043
HOMEBREW_TAP_REPOSITORY: ${{ steps.setup-homebrew.outputs.repository-path }}
4144
run: |
@@ -48,7 +51,7 @@ jobs:
4851
4952
# Setting `shell: /bin/bash` prevents shellcheck from running on
5053
# those steps, so let's change them to `shell: bash` for linting.
51-
sed -i 's:/bin/bash -e {0}:bash:' .github/workflows/*.y*ml
54+
sed -i 's|shell: /bin/bash -x|shell: bash -x|' .github/workflows/*.y*ml
5255
# The JSON matcher needs to be accessible to the container host.
5356
cp "$(brew --repository)/.github/actionlint-matcher.json" "$HOME"
5457
echo "::add-matcher::$HOME/actionlint-matcher.json"

.github/workflows/autobump.yml

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ on:
1818
permissions:
1919
contents: read
2020

21+
defaults:
22+
run:
23+
shell: bash -xeuo pipefail {0}
24+
2125
jobs:
2226
autobump:
2327
if: github.repository == 'Homebrew/homebrew-core'

.github/workflows/automerge-from-merge-queue.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
types:
88
- completed
99

10+
defaults:
11+
run:
12+
shell: bash -xeuo pipefail {0}
13+
1014
concurrency:
1115
group: automerge-merge_queue-${{ github.event.workflow_run.event }}-${{ github.event.workflow_run.id }}
1216
cancel-in-progress: true
@@ -252,9 +256,6 @@ jobs:
252256
contents: read
253257
pull-requests: read
254258
actions: write # to dispatch publish workflow
255-
defaults:
256-
run:
257-
shell: bash
258259
steps:
259260
- name: Set up Homebrew
260261
uses: Homebrew/actions/setup-homebrew@master

.github/workflows/automerge-triggers.yml

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
- unlabeled
1010
- ready_for_review
1111

12+
defaults:
13+
run:
14+
shell: bash -xeuo pipefail {0}
15+
1216
jobs:
1317
check:
1418
if: >

.github/workflows/automerge.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
types:
99
- completed
1010

11+
defaults:
12+
run:
13+
shell: bash -xeuo pipefail {0}
14+
1115
concurrency:
1216
group: automerge-${{ github.event.workflow_run.event }}-${{ github.event.workflow_run.id }}
1317
cancel-in-progress: true
@@ -182,9 +186,6 @@ jobs:
182186
contents: read
183187
pull-requests: read
184188
actions: write # to dispatch publish workflow
185-
defaults:
186-
run:
187-
shell: bash
188189
steps:
189190
- name: Set up Homebrew
190191
uses: Homebrew/actions/setup-homebrew@master

.github/workflows/cache.yml

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ env:
2020
HOMEBREW_DEVELOPER: 1
2121
HOMEBREW_NO_AUTO_UPDATE: 1
2222

23+
defaults:
24+
run:
25+
shell: bash -xeuo pipefail {0}
26+
2327
concurrency:
2428
group: cache-${{ github.event.pull_request.number }}
2529
cancel-in-progress: true

.github/workflows/clean-up-closed-prs.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
types:
66
- closed
77

8+
defaults:
9+
run:
10+
shell: bash -xeuo pipefail {0}
11+
812
concurrency:
913
group: ${{ github.workflow }}-${{ github.event.number }}
1014
cancel-in-progress: true
@@ -23,9 +27,6 @@ jobs:
2327
runs-on: ubuntu-latest
2428
container:
2529
image: ghcr.io/homebrew/ubuntu22.04:master
26-
defaults:
27-
run:
28-
shell: bash
2930
permissions:
3031
contents: read
3132
actions: write # for `gh run cancel`

.github/workflows/create-replacement-pr.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Create replacement pull request
22
run-name: "Replace PR #${{ inputs.pull_request }}"
33

4+
defaults:
5+
run:
6+
shell: bash -xeuo pipefail {0}
7+
48
concurrency:
59
group: ${{ github.workflow }}-${{ github.event.inputs.pull_request }}-${{ github.event.inputs.upload }}
610
cancel-in-progress: ${{ !fromJson(github.event.inputs.upload) }}
@@ -56,9 +60,6 @@ jobs:
5660
repository-projects: write # for `gh pr edit`
5761
attestations: write # for actions/attest-build-provenance
5862
id-token: write # for actions/attest-build-provenance
59-
defaults:
60-
run:
61-
shell: bash
6263
steps:
6364
- name: Post comment once started
6465
uses: Homebrew/actions/post-comment@master

.github/workflows/dispatch-build-bottle.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ env:
4040
DISPATCH_BUILD_BOTTLE_ISSUE: ${{ inputs.issue }}
4141
DISPATCH_BUILD_BOTTLE_UPLOAD: ${{ inputs.upload }}
4242

43+
defaults:
44+
run:
45+
shell: bash -xeuo pipefail {0}
46+
4347
# Intentionally the same as dispatch-rebottle
4448
concurrency: bottle-${{ github.event.inputs.formula }}
4549

@@ -143,7 +147,7 @@ jobs:
143147
contents: read
144148
defaults:
145149
run:
146-
shell: /bin/bash -e {0}
150+
shell: /bin/bash -xeuo pipefail {0}
147151
working-directory: ${{matrix.workdir || github.workspace}}
148152
env:
149153
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -197,9 +201,6 @@ jobs:
197201
if: inputs.upload
198202
container:
199203
image: ghcr.io/homebrew/ubuntu22.04:master
200-
defaults:
201-
run:
202-
shell: bash
203204
env:
204205
HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1
205206
GH_REPO: ${{github.repository}}

.github/workflows/dispatch-rebottle.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ on:
3131
default: true
3232
required: false
3333

34+
defaults:
35+
run:
36+
shell: bash -xeuo pipefail {0}
37+
3438
# Intentionally the same as dispatch-build-bottle
3539
concurrency: bottle-${{ github.event.inputs.formula }}
3640

@@ -84,7 +88,7 @@ jobs:
8488
timeout-minutes: ${{fromJson(inputs.timeout)}}
8589
defaults:
8690
run:
87-
shell: /bin/bash -e {0}
91+
shell: /bin/bash -xeuo pipefail {0}
8892
working-directory: ${{matrix.workdir || github.workspace}}
8993
env:
9094
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -134,9 +138,6 @@ jobs:
134138
if: inputs.upload
135139
container:
136140
image: ghcr.io/homebrew/ubuntu22.04:master
137-
defaults:
138-
run:
139-
shell: bash
140141
env:
141142
HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1
142143
GH_REPO: ${{github.repository}}

.github/workflows/manage-pull-request-labels.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
types:
66
- unlabeled
77

8+
defaults:
9+
run:
10+
shell: bash -xeuo pipefail {0}
11+
812
concurrency:
913
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.label.name }}
1014
cancel-in-progress: true

.github/workflows/publish-commit-bottles.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ on:
3232
description: "Message to include when autosquashing revision bumps, deletions, and rebuilds (requires autosquash)"
3333
required: false
3434

35+
defaults:
36+
run:
37+
shell: bash -xeuo pipefail {0}
38+
3539
env:
3640
PR: ${{inputs.pull_request}}
3741
INPUT_MESSAGE: ${{ inputs.message }}
@@ -251,9 +255,6 @@ jobs:
251255
actions: read # for `brew pr-pull`
252256
pull-requests: write # for `gh pr edit|review`
253257
repository-projects: write # for `gh pr edit`
254-
defaults:
255-
run:
256-
shell: bash
257258
steps:
258259
- name: Post comment once started
259260
uses: Homebrew/actions/post-comment@master

.github/workflows/recreate-linux-runners.yml

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
types:
1212
- completed
1313

14+
defaults:
15+
run:
16+
shell: bash -xeuo pipefail {0}
17+
1418
concurrency:
1519
group: recreate-linux-runners-${{ github.event.workflow_run.id || github.ref }}
1620
cancel-in-progress: true

.github/workflows/remove-disabled-packages.yml

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
env:
1414
RUN_URL: ${{github.event.repository.html_url}}/actions/runs/${{github.run_id}}
1515

16+
defaults:
17+
run:
18+
shell: bash -xeuo pipefail {0}
19+
1620
concurrency:
1721
group: remove-disabled-packages
1822
cancel-in-progress: true

.github/workflows/scheduled.yml

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
# Once every day at 1AM
1111
- cron: "0 1 * * *"
1212

13+
defaults:
14+
run:
15+
shell: bash -xeuo pipefail {0}
16+
1317
concurrency:
1418
group: scheduled
1519
cancel-in-progress: true

.github/workflows/tests.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ env:
2020
GH_PROMPT_DISABLED: 1
2121
SCRIPTS_PATH: .github/workflows/scripts
2222

23+
defaults:
24+
run:
25+
shell: bash -xeuo pipefail {0}
26+
2327
concurrency:
2428
group: "tests-${{ github.ref }}"
2529
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
@@ -213,7 +217,7 @@ jobs:
213217
timeout-minutes: ${{ matrix.timeout }}
214218
defaults:
215219
run:
216-
shell: /bin/bash -e {0}
220+
shell: /bin/bash -xeuo pipefail {0}
217221
working-directory: ${{matrix.workdir || github.workspace}}
218222
env:
219223
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -332,7 +336,7 @@ jobs:
332336
timeout-minutes: ${{ matrix.timeout }}
333337
defaults:
334338
run:
335-
shell: /bin/bash -e {0}
339+
shell: /bin/bash -xeuo pipefail {0}
336340
working-directory: ${{matrix.workdir || github.workspace}}
337341
env:
338342
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/triage-ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
types:
88
- completed
99

10+
defaults:
11+
run:
12+
shell: bash -xeuo pipefail {0}
13+
1014
concurrency:
1115
group: triage-ci-${{ github.event.workflow_run.event }}-${{ github.event.workflow_run.id }}
1216
cancel-in-progress: true

.github/workflows/triage.yml

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ env:
77
GH_NO_UPDATE_NOTIFIER: 1
88
GH_PROMPT_DISABLED: 1
99

10+
defaults:
11+
run:
12+
shell: bash -xeuo pipefail {0}
13+
1014
concurrency:
1115
group: "triage-${{ github.event.number }}"
1216
cancel-in-progress: true

0 commit comments

Comments
 (0)