Skip to content

Commit 68a850a

Browse files
chore: update global workflows (#31)
1 parent b6222fc commit 68a850a

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

.github/workflows/common-lint.yml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
cmake-lint --line-width 120 --tab-size 4 ${{ steps.cmake_files.outputs.found_files }}
127127
128128
- name: Docker - find files
129-
id: dokcer_files
129+
id: docker_files
130130
if: always()
131131
run: |
132132
found_files=$(find . -type f -iname "Dockerfile" -o -iname "*.dockerfile")
@@ -137,7 +137,7 @@ jobs:
137137
echo found_files=${found_files} >> $GITHUB_OUTPUT
138138
139139
- name: Docker - hadolint
140-
if: always() && steps.dokcer_files.outputs.found_files
140+
if: always() && steps.docker_files.outputs.found_files
141141
run: |
142142
docker pull hadolint/hadolint
143143
@@ -156,7 +156,7 @@ jobs:
156156
failed=0
157157
failed_files=""
158158
159-
for file in ${{ steps.dokcer_files.outputs.found_files }}; do
159+
for file in ${{ steps.docker_files.outputs.found_files }}; do
160160
echo "::group::${file}"
161161
docker run --rm -i \
162162
-e "NO_COLOR=0" \
@@ -174,6 +174,45 @@ jobs:
174174
exit 1
175175
fi
176176
177+
- name: PowerShell - PSScriptAnalyzer
178+
if: always()
179+
shell: pwsh
180+
run: |
181+
# PSScriptAnalyzer is already installed on GitHub runners
182+
183+
# To see a list of available rules, run the following command:
184+
# Get-ScriptAnalyzerRule | Format-List
185+
186+
# Create PSScriptAnalyzer config file only if it doesn't exist
187+
if (-not (Test-Path ./PSScriptAnalyzerSettings.psd1)) {
188+
@'
189+
@{
190+
Severity=@(
191+
'Error',
192+
'Information',
193+
'Warning'
194+
)
195+
ExcludeRules=@(
196+
'PSAlignAssignmentStatement'
197+
)
198+
}
199+
'@ | Out-File -FilePath ./PSScriptAnalyzerSettings.psd1
200+
}
201+
202+
# Run PSScriptAnalyzer recursively on the whole repository
203+
Write-Host "::group::Analyzing PowerShell files"
204+
$results = Invoke-ScriptAnalyzer -Path "." -Recurse
205+
206+
if ($results) {
207+
$results | Format-Table -AutoSize
208+
Write-Host "::error::PSScriptAnalyzer found issues in PowerShell files"
209+
Write-Host "::endgroup::"
210+
exit 1
211+
} else {
212+
Write-Host "No issues found in PowerShell files"
213+
Write-Host "::endgroup::"
214+
}
215+
177216
- name: Python - flake8
178217
if: always()
179218
run: |

0 commit comments

Comments
 (0)