Skip to content

Commit e7ade02

Browse files
committed
refactor: switch swift-format workflow to macOS
- Change from Linux container to macOS runner (matches Point-Free approach) - Use Homebrew to install swift-format instead of building from source - Remove unnecessary caching, git configuration, and ref handling - Reduces workflow time from 8+ minutes to ~1 minute - Eliminates detached HEAD warnings from container environment
1 parent 308d20e commit e7ade02

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

.github/workflows/swift-format.yml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,18 @@ concurrency:
1212
jobs:
1313
swift_format:
1414
name: swift-format
15-
runs-on: ubuntu-latest
16-
container: swift:6.2
15+
runs-on: macos-latest
1716
permissions:
1817
contents: write
1918
steps:
2019
- uses: actions/checkout@v5
21-
with:
22-
ref: ${{ github.head_ref || github.ref_name }}
23-
24-
- name: Cache swift-format
25-
id: cache-swift-format
26-
uses: actions/cache@v4
27-
with:
28-
path: /usr/local/bin/swift-format
29-
key: ${{ runner.os }}-swift-format-${{ hashFiles('.github/workflows/swift-format.yml') }}
3020

3121
- name: Install swift-format
32-
if: steps.cache-swift-format.outputs.cache-hit != 'true'
33-
run: |
34-
git clone --depth 1 --branch main https://github.com/apple/swift-format.git
35-
cd swift-format
36-
swift build -c release
37-
cp .build/release/swift-format /usr/local/bin/
38-
cd ..
39-
rm -rf swift-format
22+
run: brew install swift-format
4023

4124
- name: Format
4225
run: swift-format format --ignore-unparsable-files --recursive --in-place Sources Tests
4326

44-
- name: Configure git for container
45-
run: |
46-
git config --global --add safe.directory $GITHUB_WORKSPACE
47-
git checkout main
48-
4927
- uses: stefanzweifel/git-auto-commit-action@v7
5028
with:
5129
commit_message: Run swift-format

0 commit comments

Comments
 (0)