Skip to content

Commit 0efac89

Browse files
committed
fix: use Swift 6.2 container instead of setup-swift action
The swift-actions/setup-swift@v2 action has been experiencing GPG verification failures. Switch to the more reliable Docker container approach (swift:6.2) used by other packages. Changes: - Use container: swift:6.2 instead of setup-swift action - Update safe.directory path for container environment - Cache swift-format binary in /usr/local/bin/ instead of .build/ - Matches pattern used in swift-html-to-pdf and other packages
1 parent e479133 commit 0efac89

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

.github/workflows/swift-format.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
swift_format:
1414
name: swift-format
1515
runs-on: ubuntu-latest
16+
container: swift:6.2
1617
permissions:
1718
contents: write
1819
steps:
@@ -21,32 +22,27 @@ jobs:
2122
ref: ${{ github.head_ref || github.ref_name }}
2223

2324
- name: Configure git safe directory
24-
run: git config --global --add safe.directory $PWD
25-
26-
- uses: swift-actions/setup-swift@v2
27-
with:
28-
swift-version: '6.0'
25+
run: git config --global --add safe.directory /__w/swift-html-types/swift-html-types
2926

3027
- name: Restore swift-format cache
3128
id: cache-swift-format-restore
3229
uses: actions/cache/restore@v4
3330
with:
34-
path: .build/swift-format
31+
path: /usr/local/bin/swift-format
3532
key: ${{ runner.os }}-swift-format-main-v1
3633

37-
- name: Build swift-format
34+
- name: Install swift-format
3835
if: steps.cache-swift-format-restore.outputs.cache-hit != 'true'
3936
run: |
4037
git clone --depth 1 --branch main https://github.com/apple/swift-format.git
4138
cd swift-format
4239
swift build -c release
43-
mkdir -p ../.build
44-
cp .build/release/swift-format ../.build/swift-format
40+
cp .build/release/swift-format /usr/local/bin/
4541
cd ..
4642
rm -rf swift-format
4743
4844
- name: Format
49-
run: .build/swift-format format --ignore-unparsable-files --recursive --in-place Sources Tests
45+
run: swift-format format --recursive --in-place --ignore-unparsable-files Sources Tests
5046

5147
- uses: stefanzweifel/git-auto-commit-action@v7
5248
with:
@@ -57,5 +53,5 @@ jobs:
5753
uses: actions/cache/save@v4
5854
if: steps.cache-swift-format-restore.outputs.cache-hit != 'true'
5955
with:
60-
path: .build/swift-format
56+
path: /usr/local/bin/swift-format
6157
key: ${{ runner.os }}-swift-format-main-v1

0 commit comments

Comments
 (0)