Skip to content

Commit 6d231de

Browse files
committed
Format source code and run git diff instead of listing first
The diff yields more insightful results than `swift-format lint`
1 parent b639ffe commit 6d231de

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/pull_request.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,40 @@ jobs:
3737
uses: actions/checkout@v4
3838
with:
3939
persist-credentials: false
40+
- name: Mark the workspace as safe
41+
# https://github.com/actions/checkout/issues/766
42+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
4043
- name: Check out related PRs
4144
run: |
4245
apt-get update && apt-get install -y curl
4346
curl -s https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/cross-pr-checkout.swift > /tmp/cross-pr-checkout.swift
4447
swift /tmp/cross-pr-checkout.swift "${{ github.repository }}" "${{ github.event.number }}"
4548
- name: Build
4649
run: swift build --configuration release
50+
- name: Download check format script
51+
run: |
52+
curl https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/check-swift-format.sh > /tmp/check-swift-format.sh
4753
- name: Format swift-format
48-
run: .build/release/swift-format lint --parallel --recursive --strict .
54+
run: |
55+
cd "$GITHUB_WORKSPACE"
56+
bash /tmp/check-swift-format.sh
4957
- name: Checkout swift-syntax
5058
uses: actions/checkout@v4
5159
with:
5260
repository: swiftlang/swift-syntax
5361
persist-credentials: false
5462
path: swift-syntax
5563
- name: Format swift-syntax
56-
run: .build/release/swift-format lint --parallel --recursive --strict swift-syntax
64+
run: |
65+
cd "$GITHUB_WORKSPACE/swift-syntax"
66+
bash /tmp/check-swift-format.sh
5767
- name: Checkout sourcekit-lsp
5868
uses: actions/checkout@v4
5969
with:
6070
repository: swiftlang/sourcekit-lsp
6171
persist-credentials: false
6272
path: sourcekit-lsp
6373
- name: Format sourcekit-lsp
64-
run: .build/release/swift-format lint --parallel --recursive --strict sourcekit-lsp
74+
run: |
75+
cd "$GITHUB_WORKSPACE/sourcekit-lsp"
76+
bash /tmp/check-swift-format.sh

0 commit comments

Comments
 (0)