Update README.md #62
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
name: "[macOS] SwiftLint" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Run SwiftLint | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.0 | |
- name: Install SwiftLint | |
run: brew install swiftlint | |
- name: Run SwiftLint and annotate | |
run: | | |
# Run SwiftLint and capture output | |
OUTPUT=$(swiftlint lint --reporter github-actions-logging) | |
# Print the output so GitHub Actions can pick up annotations | |
echo "$OUTPUT" | |
# Fail the job if any violations are found | |
if [ -n "$OUTPUT" ]; then | |
echo "SwiftLint violations found. Failing the action." | |
exit 1 | |
else | |
echo "No SwiftLint violations found." | |
fi |