0

I'm using Github action to lint the swift language and using SwiftLint for that. I want SwiftLint to check only the committed and edited files in my project. I've tried multiple solutions, but none of them have worked. Any suggestions or guidance would be appreciated.

Here is the YAML file

name: SwiftLint
on:
 push:
 branches:
 - 'cicd' 
 
 pull_request:
 branches:
 - 'cicd' 
 
jobs:
 SwiftLint:
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v1
 - name: GitHub Action for SwiftLint
 uses: norio-nomura/[email protected]
 - name: GitHub Action for SwiftLint with --strict
 uses: norio-nomura/[email protected]
 with:
 args: --strict
 - name: GitHub Action for SwiftLint (Only files changed in the PR compared to 'main')
 uses: norio-nomura/[email protected]
 env:
 DIFF_BASE: 'main' # Compare changes in 'cide-sonarqube' against 'main'
 - name: GitHub Action for SwiftLint (Different working directory)
 uses: norio-nomura/[email protected]
 env:
 WORKING_DIRECTORY: Source
asked Jan 3, 2025 at 14:44
4
  • You have a ".swiftlint.yml" in your project when you push, the github action run with this file rules -> it depends on your ".swiftlint.yml" file not work with the action Commented Jan 4, 2025 at 8:25
  • All of rules exculde or include files and rules exists in this file ".swiftlint.yml" Commented Jan 4, 2025 at 8:25
  • Some times the Swiftlint package updates in the Github server but your local laptop Swiftlint package version is still old, you may have an error in the Github but can't see that on you local(old version of Swiftlint). Commented Jan 4, 2025 at 8:29
  • Finally if you want that, you should update or create a dynamic ".swiftlint.yml" file that include just the updated file and exclude other files. Commented Jan 4, 2025 at 8:31

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.