Create labeler.yml #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |