A GitHub Action that installs a pinned SwiftFormat and runs swiftformat --lint with GitHub Actions annotations. Designed to compose with the rest of the Apple-Actions suite:
Apple-Actions/swiftlintApple-Actions/peripheryApple-Actions/import-codesign-certsApple-Actions/download-provisioning-profilesApple-Actions/xcodebuildApple-Actions/upload-testflight-buildApple-Actions/create-dmgApple-Actions/notarize
- uses: Apple-Actions/swiftformat@v1
with:
version: 0.64.4Put the version on the first non-comment line of a file (for example .swiftformat-version):
0.64.4
- uses: Apple-Actions/swiftformat@v1
with:
version-file: .swiftformat-versionIf both version and version-file are set, version wins. If neither is set, the action installs the latest SwiftFormat release.
- uses: Apple-Actions/swiftformat@v1
with:
version: 0.64.4
path: Sources
reporter: github-actions-log| Input | Default | Description |
|---|---|---|
version |
SwiftFormat version (for example 0.64.4) or latest |
|
version-file |
Path to a file containing the version | |
path |
Path to lint (defaults to .) |
|
args |
Extra arguments appended to swiftformat |
|
reporter |
github-actions-log |
SwiftFormat reporter |
lint |
true |
Pass --lint so files that would change fail the step |
token |
${{ github.token }} |
Token for GitHub Releases API / downloads |
| Output | Description |
|---|---|
version |
Resolved SwiftFormat version that was installed |
swiftformat-path |
Absolute path to the swiftformat binary |
Works on ubuntu-* and macos-* runners (downloads the matching macOS / Linux release asset). Honors a workspace .swiftformat config when present. Submodule paths listed in .gitmodules are excluded automatically unless you already pass --exclude.