Skip to content

Commit

Permalink
Test workflow by separating PSSA workflow PowerShell code into its ow…
Browse files Browse the repository at this point in the history
…n file.
  • Loading branch information
jonnybottles committed Nov 26, 2024
1 parent c73ed3e commit 10473de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/psscriptanalyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 10473de

Please sign in to comment.