-
Notifications
You must be signed in to change notification settings - Fork 0
26 lines (26 loc) · 740 Bytes
/
ci.yml
File metadata and controls
26 lines (26 loc) · 740 Bytes
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
name: CI
on:
push:
branches:
- main
jobs:
swift-format:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Run SwiftFormat with License Header
run: |
# Read LICENSE file, add `// ` before each line.
LICENSE_BLOCK=$(sed 's/^/\/\/ /' LICENSE)
swiftformat . --header "$LICENSE_BLOCK" --disable trailingCommas
- name: Commit and Push Changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
if ! git diff --quiet --staged; then
git commit -m "Apply SwiftFormat"
git push origin main
else
echo "No changes to commit"
fi