Created
October 12, 2023 14:36
-
-
Save TheCoordinator/60fe36f8ed5402c5c4e53152448c3c5d to your computer and use it in GitHub Desktop.
SwiftLint using Ubuntu only on changed files
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: 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