action-swiftlint
action-swiftlint copied to clipboard
Support running on macos runners
Title is pretty self explanatory.
We have our own macos build machine that we hooked up to be a runner (so we dont have to pay for github actions).
It would be nice to be able to run this workflow on a mac machine.
+1 - I would love to use it on macOS as well
yes please!
I have the same request. In the meantime this little workflow gets the job done by running swiftlint only on changed files on our self hosted macOS runner.
name: Linter - SwiftLint
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
swift_format:
name: lint
runs-on: [self-hosted, iOS]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Run swiftlint
run: |
echo ""
echo "🏃♂️ Running swiftlint on modified files 🤵♂️"
git diff --name-status origin/main \
| grep -E "^A|^M" | sed "s/^[AM]\t//g" \
| grep -E "\.swift\$$" \
|| echo "No files added nor modified!"
git diff --name-status origin/main \
| grep -E "^A|^M" | sed "s/^[AM]\t//g" \
| grep -E "\.swift\$$" \
| xargs --no-run-if-empty swiftlint lint --quiet --strict --reporter github-actions-logging
Everyone interested, please checkout "SwiftLint Annotations" Action which doesn't use Docker and natively runs swiftlint
binary.