Skip to content

Update README.md

Update README.md #62

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