Skip to content

Instantly share code, notes, and snippets.

@TheCoordinator
Created October 12, 2023 14:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheCoordinator/60fe36f8ed5402c5c4e53152448c3c5d to your computer and use it in GitHub Desktop.
Save TheCoordinator/60fe36f8ed5402c5c4e53152448c3c5d to your computer and use it in GitHub Desktop.
SwiftLint using Ubuntu only on changed files
name: Pull Request
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- '**.md'
jobs:
swiftlint:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed Swift files
id: changed-files-yaml
uses: tj-actions/changed-files@v39
with:
files_yaml: |
swift:
- '**/*.swift'
separator: ' '
- name: SwiftLint
if: steps.changed-files-yaml.outputs.swift_any_changed == 'true'
run: |
docker pull ghcr.io/realm/swiftlint:$VERSION
# Runs SwiftLint only on changed files (Added, Modified, Copied) separated by space
docker run -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:$VERSION swiftlint lint ${{ steps.changed-files-yaml.outputs.swift_all_changed_files }} --strict --reporter github-actions-logging;
env:
VERSION: 0.53.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment