-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.05 KB
/
swift.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
name: SwiftLint Autocorrect
on:
pull_request:
push:
branches:
- main # Adjust this to target the branch you want to lint
jobs:
lint:
runs-on: macos-latest # macOS is required for SwiftLint
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Install SwiftLint
run: |
if ! command -v swiftlint &> /dev/null; then
echo "Installing SwiftLint..."
brew install swiftlint
fi
- name: Run SwiftLint autocorrect
run: |
echo "Running SwiftLint "
swiftlint --fix
# Optional: Commit and push changes if autocorrect made modifications
- name: Commit SwiftLint fixes
run: |
if [[ `git status --porcelain` ]]; then
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Apply SwiftLint autocorrect fixes"
git push
fi