Skip to content

Commit d65e27b

Browse files
committed
ci: pin swiftformat version and verify checksum
1 parent 697806e commit d65e27b

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

.github/workflows/format.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,36 @@ on:
44
pull_request:
55
types: [opened, synchronize]
66

7+
permissions:
8+
contents: read
9+
10+
env:
11+
# Pinned so the formatter cannot drift underneath us. Bumping this is a
12+
# deliberate PR that also reformats the repo; update the checksum alongside it
13+
# (shasum -a 256 swiftformat.zip).
14+
SWIFTFORMAT_VERSION: 0.62.1
15+
SWIFTFORMAT_SHA256: 7cb1cb1fae04932047c7015441c543848e8e60e1572d808d080e0a1f1661114a
16+
717
jobs:
818
swiftformat:
919
runs-on: macOS-latest
1020

1121
steps:
1222
- uses: actions/checkout@v3
1323

14-
- name: Install SwiftFormat
15-
run: brew install swiftformat
24+
- name: Install SwiftFormat ${{ env.SWIFTFORMAT_VERSION }}
25+
run: |
26+
set -euo pipefail
27+
curl --fail --silent --show-error --location \
28+
--output swiftformat.zip \
29+
"https://github.com/nicklockwood/SwiftFormat/releases/download/${SWIFTFORMAT_VERSION}/swiftformat.zip"
30+
echo "${SWIFTFORMAT_SHA256} swiftformat.zip" | shasum -a 256 --check --status
31+
unzip -q swiftformat.zip -d "${RUNNER_TEMP}/swiftformat"
32+
chmod +x "${RUNNER_TEMP}/swiftformat/swiftformat"
33+
echo "${RUNNER_TEMP}/swiftformat" >> "${GITHUB_PATH}"
1634
1735
- name: Run SwiftFormat in Strict Mode
18-
run: swiftformat . --strict
36+
run: |
37+
set -euo pipefail
38+
swiftformat --version
39+
swiftformat . --strict

0 commit comments

Comments
 (0)