File tree Expand file tree Collapse file tree 1 file changed +39
-6
lines changed Expand file tree Collapse file tree 1 file changed +39
-6
lines changed Original file line number Diff line number Diff line change 11name : Swift Format
2+
23on :
34 push :
4- branches : [main]
5+ branches :
6+ - main
7+
8+ concurrency :
9+ group : format-${{ github.ref }}
10+ cancel-in-progress : true
511
612jobs :
7- format :
13+ swift_format :
14+ name : swift-format
815 runs-on : ubuntu-latest
16+ permissions :
17+ contents : write
918 steps :
1019 - uses : actions/checkout@v5
11- - name : Format code
20+
21+ - name : Setup Swift
22+ uses : swift-actions/setup-swift@v2
23+ with :
24+ swift-version : ' 6.0'
25+
26+ - name : Cache swift-format
27+ id : cache-swift-format
28+ uses : actions/cache@v4
29+ with :
30+ path : /usr/local/bin/swift-format
31+ key : ${{ runner.os }}-swift-format-${{ hashFiles('.github/workflows/swift-format.yml') }}
32+
33+ - name : Install swift-format
34+ if : steps.cache-swift-format.outputs.cache-hit != 'true'
35+ run : |
36+ git clone --depth 1 --branch main https://github.com/apple/swift-format.git
37+ cd swift-format
38+ swift build -c release
39+ sudo cp .build/release/swift-format /usr/local/bin/
40+ cd ..
41+ rm -rf swift-format
42+
43+ - name : Format
1244 run : swift-format format --recursive --in-place Sources Tests
13- - name : Commit changes
14- uses : stefanzweifel/git-auto-commit-action@v7
45+
46+ - uses : stefanzweifel/git-auto-commit-action@v7
1547 with :
16- commit_message : " Run swift-format"
48+ commit_message : Run swift-format
49+ branch : ' main'
You can’t perform that action at this time.
0 commit comments