@@ -2,31 +2,27 @@ name: SwiftLint
22
33on :
44 pull_request :
5- branches :
6- - ' **' # Run on all branches for PRs
5+ paths :
6+ - ' .github/workflows/swiftlint.yml'
7+ - ' .swiftlint.yml'
8+ - ' **/*.swift'
79
810jobs :
9- lint :
10- runs-on : ubuntu-latest # Use the latest Linux environment
11-
11+ SwiftLint :
12+ runs-on : ubuntu-latest
1213 steps :
13- # Step 1: Check out the repository
14- - name : Checkout repository
15- uses : actions/checkout@v3
16-
17- # Step 2: Install SwiftLint
18- - name : Install SwiftLint
19- run : |
20- sudo apt-get update
21- sudo apt-get install -y curl git libssl-dev libcurl4-openssl-dev libz-dev
22- curl -fsSL https://swift.org/builds/swift-5.9.1-release/ubuntu2004/swift-5.9.1-RELEASE/swift-5.9.1-RELEASE-ubuntu20.04.tar.gz | tar -xz -C /usr/local --strip-components=1
23- git clone https://github.com/realm/SwiftLint.git
24- cd SwiftLint
25- swift build -c release
26- sudo cp .build/release/swiftlint /usr/local/bin
27-
28- # Step 3: Run SwiftLint and parse errors
29- - name : Run SwiftLint
30- run : |
31- set -o pipefail
32- swiftlint lint --strict --quiet | sed -E 's/^(.*):([0-9]+):([0-9]+): (warning|error|[^:]+): (.*)/::\4 title=Lint error,file=\1,line=\2,col=\3::\5\n\1:\2:\3/'
14+ - uses : actions/checkout@v1
15+ - name : GitHub Action for SwiftLint
16+ uses :
norio-nomura/[email protected] 17+ - name : GitHub Action for SwiftLint with --strict
18+ uses :
norio-nomura/[email protected] 19+ with :
20+ args : --strict
21+ - name : GitHub Action for SwiftLint (Only files changed in the PR)
22+ uses :
norio-nomura/[email protected] 23+ env :
24+ DIFF_BASE : ${{ github.base_ref }}
25+ - name : GitHub Action for SwiftLint (Different working directory)
26+ uses :
norio-nomura/[email protected] 27+ env :
28+ WORKING_DIRECTORY : Source
0 commit comments