-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a swift-format check to run on PRs.
Based off the swift-nio ones.
- Loading branch information
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: swift-format Check | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
format-check: | ||
name: swift-format Check | ||
runs-on: ubuntu-latest | ||
container: | ||
# Use use the latest Swift release and that's the version of swift-format | ||
# people should use. | ||
image: swift:latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Mark the workspace as safe | ||
# https://github.com/actions/checkout/issues/766 | ||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE} | ||
- name: Run format check | ||
run: | | ||
set -eu | ||
git ls-files -z '*.swift' | xargs -0 swift format format --parallel --in-place | ||
GIT_PAGER='' git diff --exit-code '*.swift' | ||
# Disabled as it produces multiple warnings at the moment. | ||
# - name: Run format lint check | ||
# run: | | ||
# set -eu | ||
# git ls-files -z '*.swift' | xargs -0 swift format lint --strict --parallel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters