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
-
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 actionMaziar Saadatfar– Maziar Saadatfar2025年01月04日 08:25:09 +00:00Commented Jan 4, 2025 at 8:25
-
All of rules exculde or include files and rules exists in this file ".swiftlint.yml"Maziar Saadatfar– Maziar Saadatfar2025年01月04日 08:25:53 +00:00Commented 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).Maziar Saadatfar– Maziar Saadatfar2025年01月04日 08:29:33 +00:00Commented 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.Maziar Saadatfar– Maziar Saadatfar2025年01月04日 08:31:53 +00:00Commented Jan 4, 2025 at 8:31
default