Skip to content

Create labeler.yml

Create labeler.yml #4

name: Swift Format
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
swift-format:
runs-on: macos-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Swift
run: swift --version
- name: Install SwiftFormat
run: brew install swiftformat
- name: Run SwiftFormat
run: swiftformat . --swiftversion 5.5
- name: Commit and push changes if needed
run: |
if [[ `git status --porcelain` ]]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "style: automated SwiftFormat code formatting"
git push
else
echo "No formatting changes detected."
fi