-
-
Notifications
You must be signed in to change notification settings - Fork 33
42 lines (34 loc) · 960 Bytes
/
SwiftLint-macOS.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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