updating yml to only look at the files that where changed #21
This file contains 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: Lint Code | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
- feature/linter | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
lint: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.12.4' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pylint | |
- name: Find Changed Files | |
shell: pwsh | |
run: | | |
$CHANGED_FILES = git diff --name-only HEAD~1 HEAD | |
Write-Host "Changed files:" | |
Write-Host $CHANGED_FILES | |
echo "changed_files=$CHANGED_FILES" >> $env:GITHUB_ENV | |
- name: Running Pylint | |
shell: pwsh | |
run: | | |
$failed = $false | |
$files = $env:changed_files -split "`n" | |
foreach ($file in $files) { | |
pylint --fail-under=8.5 $file | |
if ($LASTEXITCODE -ne 0) { | |
$failed = $true | |
} | |
} | |
if ($failed) { | |
exit 1 | |
} | |