Skip to content

Commit 2455184

Browse files
committed
20220912A
1 parent e0d9ff2 commit 2455184

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

hugoalh.GitHubActionsToolkit/module/problem-matcher.psm1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ Function Add-ProblemMatcher {
2626
[Parameter(Mandatory = $True, ParameterSetName = 'LiteralPath', ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)][ValidatePattern('^.+$', ErrorMessage = 'Parameter `LiteralPath` must be in single line string!')][Alias('LiteralFile', 'LiteralFiles', 'LiteralPaths', 'LP', 'PSPath', 'PSPaths')][String[]]$LiteralPath
2727
)
2828
Process {
29-
(($PSCmdlet.ParameterSetName -ieq 'LiteralPath') ? $LiteralPath : [String[]](Resolve-Path -Path $Path)) |
29+
($PSCmdlet.ParameterSetName -ieq 'LiteralPath') ? $LiteralPath : (
30+
[String[]](Resolve-Path -Path $Path) |
31+
Where-Object -FilterScript { ![String]::IsNullOrEmpty($_) }
32+
) |
3033
ForEach-Object -Process { Write-GitHubActionsCommand -Command 'add-matcher' -Value ($_ -ireplace '^\.[\\/]', '' -ireplace '\\', '/') }
3134
}
3235
}

hugoalh.GitHubActionsToolkit/module/utility.psm1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,13 @@ Function Get-WebhookEventPayload {
8080
[UInt16]$Depth = 1024,
8181
[Switch]$NoEnumerate
8282
)
83-
Get-Content -LiteralPath $Env:GITHUB_EVENT_PATH -Raw -Encoding 'UTF8NoBOM' |
84-
ConvertFrom-Json -AsHashtable:$AsHashtable.IsPresent -Depth $Depth -NoEnumerate:$NoEnumerate.IsPresent |
85-
Write-Output
83+
If (Test-Environment) {
84+
Get-Content -LiteralPath $Env:GITHUB_EVENT_PATH -Raw -Encoding 'UTF8NoBOM' |
85+
ConvertFrom-Json -AsHashtable:$AsHashtable.IsPresent -Depth $Depth -NoEnumerate:$NoEnumerate.IsPresent |
86+
Write-Output
87+
Return
88+
}
89+
Write-Error -Message 'Unable to get GitHub Actions resources!' -Category 'ResourceUnavailable'
8690
}
8791
Set-Alias -Name 'Get-Event' -Value 'Get-WebhookEventPayload' -Option 'ReadOnly' -Scope 'Local'
8892
Set-Alias -Name 'Get-Payload' -Value 'Get-WebhookEventPayload' -Option 'ReadOnly' -Scope 'Local'

0 commit comments

Comments
 (0)