-
Notifications
You must be signed in to change notification settings - Fork 591
49 lines (43 loc) · 1.35 KB
/
linter.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
43
44
45
46
47
48
49
name: Linter
run-name: 🩺 Code checks on ${{ github.event_name == 'pull_request' && 'PR' || '🌱' }} ${{ github.event_name == 'pull_request' && github.event.number || github.ref_name }}
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
eslint:
name: ESLint
runs-on: ubuntu-latest # using linux runner for speed
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install modules
run: yarn
- name: Install example
run: yarn bootstrap-linux
- name: Lint
run: yarn lint
ios:
name: Lint iOS
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: brew bundle
- name: Run swiftlint
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
updatedFiles=$(git --no-pager diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- '*.swift')
if [[ -z "$updatedFiles" ]]; then
echo "No Swift files changed, skipping linting"
exit 0
fi
swiftlint --reporter github-actions-logging -- $updatedFiles
else
swiftlint
fi