-
Notifications
You must be signed in to change notification settings - Fork 30
42 lines (36 loc) · 1.12 KB
/
swiftformat.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Swiftformat
on: pull_request
jobs:
swiftformat:
name: Check swiftformat
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: recursive
- name: Restore swift build cache
uses: actions/cache@v2
with:
path: .build
key: ${{ runner.os }}-spm2-
restore-keys: |
${{ runner.os }}-spm2-
- name: swift build
run: |
if [ -d ".build" ]; then
if ! [ -x "$(command -v swift-format)" ]; then
sudo cp -f .build/release/swiftformat /usr/local/bin/swiftformat
fi
else
git clone --depth 1 https://github.com/nicklockwood/SwiftFormat
cd SwiftFormat
swift build --disable-sandbox -c release
mv .build .. && cd ..
rm -rf SwiftFormat
sudo cp -f .build/release/swiftformat /usr/local/bin/swiftformat
fi
- name: Run swiftformat
run: swiftformat .
- name: Verify formatted code is unchanged
run: git diff --exit-code HEAD