From 10473de1c61b930b51972248bdbeca1cf49d9c69 Mon Sep 17 00:00:00 2001 From: Jonathan Butler Date: Tue, 26 Nov 2024 11:50:14 -0500 Subject: [PATCH] Test workflow by separating PSSA workflow PowerShell code into its own file. --- .github/workflows/psscriptanalyzer.yml | 2 +- ...llScriptAnalyzer.ps1 => Invoke-GitHubPSScriptAnalyzer.ps1} | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) rename Hawk/internal/scripts/git_hub_action_scripts/{Invoke-PowerShellScriptAnalyzer.ps1 => Invoke-GitHubPSScriptAnalyzer.ps1} (92%) diff --git a/.github/workflows/psscriptanalyzer.yml b/.github/workflows/psscriptanalyzer.yml index 504af02..9b44d28 100644 --- a/.github/workflows/psscriptanalyzer.yml +++ b/.github/workflows/psscriptanalyzer.yml @@ -55,7 +55,7 @@ jobs: run: | $settingsPath = Join-Path $env:GITHUB_WORKSPACE 'Hawk' 'internal' 'configurations' 'PSScriptAnalyzerSettings.psd1' $changedFiles = Get-Content -Path "$env:GITHUB_WORKSPACE/changed_files.txt" - $scriptPath = Join-Path $env:GITHUB_WORKSPACE 'Hawk' 'internal' 'scripts' 'git_hub_action_scripts' 'Invoke-PowerShellScriptAnalyzer.ps1' + $scriptPath = Join-Path $env:GITHUB_WORKSPACE 'Hawk' 'internal' 'scripts' 'git_hub_action_scripts' 'Invoke-GitHubPSScriptAnalyzer.ps1' . $scriptPath -SettingsPath $settingsPath -ChangedFiles $changedFiles - name: Upload Results diff --git a/Hawk/internal/scripts/git_hub_action_scripts/Invoke-PowerShellScriptAnalyzer.ps1 b/Hawk/internal/scripts/git_hub_action_scripts/Invoke-GitHubPSScriptAnalyzer.ps1 similarity index 92% rename from Hawk/internal/scripts/git_hub_action_scripts/Invoke-PowerShellScriptAnalyzer.ps1 rename to Hawk/internal/scripts/git_hub_action_scripts/Invoke-GitHubPSScriptAnalyzer.ps1 index a5d39fa..6dafad7 100644 --- a/Hawk/internal/scripts/git_hub_action_scripts/Invoke-PowerShellScriptAnalyzer.ps1 +++ b/Hawk/internal/scripts/git_hub_action_scripts/Invoke-GitHubPSScriptAnalyzer.ps1 @@ -47,11 +47,13 @@ function Invoke-GitHubPSScriptAnalyzer { if ($results) { Write-Output "Found $($results.Count) issues in changed files:" - $results | Format-Table -AutoSize | Out-String | Write-Output + $results | Format-Table -AutoSize | Out-String | Write-Host $results | Format-Table -AutoSize | Out-File (Join-Path $env:GITHUB_WORKSPACE 'psscriptanalyzer-results.txt') exit 1 } else { Write-Output "No PSScriptAnalyzer issues found in changed files" + $null > (Join-Path $env:GITHUB_WORKSPACE 'psscriptanalyzer-results.txt') + exit 0 } } \ No newline at end of file