Skip to content

fix: add Swift setup step for Linux runners #7

fix: add Swift setup step for Linux runners

fix: add Swift setup step for Linux runners #7

Workflow file for this run

name: Swift Format
on:
push:
branches:
- main
concurrency:
group: format-${{ github.ref }}
cancel-in-progress: true
jobs:
swift_format:
name: swift-format
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Setup Swift
uses: swift-actions/setup-swift@v2
with:
swift-version: '6.0'
- name: Cache swift-format
id: cache-swift-format
uses: actions/cache@v4
with:
path: /usr/local/bin/swift-format
key: ${{ runner.os }}-swift-format-${{ hashFiles('.github/workflows/swift-format.yml') }}
- name: Install swift-format
if: steps.cache-swift-format.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch main https://github.com/apple/swift-format.git
cd swift-format
swift build -c release
sudo cp .build/release/swift-format /usr/local/bin/
cd ..
rm -rf swift-format
- name: Format
run: swift-format format --recursive --in-place Sources Tests
- uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: Run swift-format
branch: 'main'