Skip to content

Commit 9b6ce06

Browse files
committed
ci: run swift format
1 parent b159fb9 commit 9b6ce06

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

.github/workflows/format.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Format
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
8+
concurrency:
9+
group: format-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
swift_format:
14+
name: swift-format
15+
runs-on: macos-14
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Select Xcode 16
19+
run: sudo xcode-select -s /Applications/Xcode_16.app
20+
- name: Install swift-format
21+
run: brew install swift-format
22+
- name: Format
23+
run: make format
24+
- uses: stefanzweifel/git-auto-commit-action@v4
25+
with:
26+
commit_message: "style: run swift-format"
27+
branch: "main"
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,14 @@ build-examples:
107107
done
108108

109109
format:
110-
@swiftformat .
110+
find . \
111+
-path '*/Documentation.docc' -prune -o \
112+
-name '*.swift' \
113+
-not -path '*/.*' -print0 \
114+
| xargs -0 swift format --ignore-unparsable-files --in-place
111115

112116
.PHONY: test-library test-linux build-example format
113117

114118
define udid_for
115119
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
116-
endef
120+
endef

0 commit comments

Comments
 (0)