Invoke swiftformat via Swift Package Manager plugin
#86
Workflow file for this run
This file contains hidden or 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
| name: Swift Format | |
| on: | |
| pull_request: | |
| paths: | |
| - '**.swift' | |
| workflow_dispatch: | |
| jobs: | |
| swift-format: | |
| name: Check Swift Formatting | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check formatting | |
| run: swift package plugin --allow-writing-to-package-directory swiftformat --lint --config .swiftformat . | |
| - name: Suggest fixes (if check fails) | |
| if: failure() | |
| run: | | |
| echo "### Here's how to fix the formatting locally:" >> $GITHUB_STEP_SUMMARY | |
| echo '```bash' >> $GITHUB_STEP_SUMMARY | |
| echo "# Format all Swift files using SPM plugin" >> $GITHUB_STEP_SUMMARY | |
| echo 'swift package plugin --allow-writing-to-package-directory swiftformat --config .swiftformat .' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY |