Remove double warning #113
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: PowerShell Lint and Format | |
on: | |
push: | |
jobs: | |
lint_and_format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Git | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
- name: Format PowerShell scripts | |
shell: pwsh | |
run: | | |
$files = Get-ChildItem -Recurse -Include *.ps1 | |
foreach ($file in $files) { | |
Write-Output "Formatting $file" | |
$content = Get-Content -Path $file.FullName -Raw | |
$formatted = Invoke-Formatter -ScriptDefinition $content | |
Set-Content -Path $file.FullName -Value $formatted -NoNewline | |
} | |
- name: Lint PowerShell scripts | |
shell: pwsh | |
run: | | |
$files = Get-ChildItem -Recurse -Include *.ps1 | |
foreach ($file in $files) { | |
Write-Output "Linting $file" | |
Invoke-ScriptAnalyzer -Path $file.FullName -Recurse -Severity Warning,Error -ExcludeRule PSReviewUnusedParameter | |
} | |
- name: Commit changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add -A | |
git commit -m "Formatted files" || echo "No changes to commit" | |
git push |