Skip to content

Commit

Permalink
Try and address path failure in workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnybottles committed Nov 19, 2024
1 parent 6684d61 commit 4859dc1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/psscriptanalzyer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Debug Environment
shell: pwsh
run: |
Write-Host "Current location: $(Get-Location)"
Write-Host "GITHUB_WORKSPACE: $env:GITHUB_WORKSPACE"
Write-Host "Directory contents:"
Get-ChildItem -Path $env:GITHUB_WORKSPACE -Recurse | Select-Object FullName | Format-Table -AutoSize
- name: Install PSScriptAnalyzer
shell: pwsh
run: |
Expand All @@ -32,16 +40,26 @@ jobs:
- name: Run PSScriptAnalyzer
shell: pwsh
run: |
# Verify settings file exists
# Debug Paths
Write-Host "Looking for settings file..."
$settingsPath = Join-Path $env:GITHUB_WORKSPACE '.github/psscriptanalyzer/PSScriptAnalyzerSettings.psd1'
Write-Host "Settings path: $settingsPath"
# Check .github folder
$githubPath = Join-Path $env:GITHUB_WORKSPACE '.github'
Write-Host "`n.github folder contents:"
Get-ChildItem -Path $githubPath -Recurse | Select-Object FullName
if (-not (Test-Path $settingsPath)) {
Write-Error "PSScriptAnalyzer settings file not found at: $settingsPath"
Write-Host "Directory contents:"
Get-ChildItem -Path $env:GITHUB_WORKSPACE/.github -Recurse
exit 1
}
Write-Host "`nFound settings file. Contents:"
Get-Content $settingsPath
$results = @()
Write-Host "`nStarting analysis..."
# Analyze all PowerShell files
Get-ChildItem -Path $env:GITHUB_WORKSPACE -Recurse -Include *.ps1,*.psm1,*.psd1 |
Expand All @@ -53,7 +71,6 @@ jobs:
}
}
# Create results file if there are any issues
if ($results) {
$resultPath = Join-Path $env:GITHUB_WORKSPACE "psscriptanalyzer-results.txt"
$results | Format-Table -AutoSize | Out-File -FilePath $resultPath
Expand Down
2 changes: 1 addition & 1 deletion Hawk/tests/general/Test-PreCommitHook.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# 3. Observe the PSScriptAnalyzer warnings/errors

#region Good Code Examples - These will pass PSScriptAnalyzer
# add comment to test
# add comment to tests
function Test-GoodFunction {
[CmdletBinding()]
param (
Expand Down

0 comments on commit 4859dc1

Please sign in to comment.