Skip to content

Second test run

Second test run #119

Workflow file for this run

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 "actions@github.com"
- 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