Skip to content

Commit

Permalink
20220912A
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoalh committed Sep 12, 2022
1 parent e0d9ff2 commit 2455184
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion hugoalh.GitHubActionsToolkit/module/problem-matcher.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ Function Add-ProblemMatcher {
[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
)
Process {
(($PSCmdlet.ParameterSetName -ieq 'LiteralPath') ? $LiteralPath : [String[]](Resolve-Path -Path $Path)) |
($PSCmdlet.ParameterSetName -ieq 'LiteralPath') ? $LiteralPath : (
[String[]](Resolve-Path -Path $Path) |
Where-Object -FilterScript { ![String]::IsNullOrEmpty($_) }
) |
ForEach-Object -Process { Write-GitHubActionsCommand -Command 'add-matcher' -Value ($_ -ireplace '^\.[\\/]', '' -ireplace '\\', '/') }
}
}
Expand Down
10 changes: 7 additions & 3 deletions hugoalh.GitHubActionsToolkit/module/utility.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ Function Get-WebhookEventPayload {
[UInt16]$Depth = 1024,
[Switch]$NoEnumerate
)
Get-Content -LiteralPath $Env:GITHUB_EVENT_PATH -Raw -Encoding 'UTF8NoBOM' |
ConvertFrom-Json -AsHashtable:$AsHashtable.IsPresent -Depth $Depth -NoEnumerate:$NoEnumerate.IsPresent |
Write-Output
If (Test-Environment) {
Get-Content -LiteralPath $Env:GITHUB_EVENT_PATH -Raw -Encoding 'UTF8NoBOM' |
ConvertFrom-Json -AsHashtable:$AsHashtable.IsPresent -Depth $Depth -NoEnumerate:$NoEnumerate.IsPresent |
Write-Output
Return
}
Write-Error -Message 'Unable to get GitHub Actions resources!' -Category 'ResourceUnavailable'
}
Set-Alias -Name 'Get-Event' -Value 'Get-WebhookEventPayload' -Option 'ReadOnly' -Scope 'Local'
Set-Alias -Name 'Get-Payload' -Value 'Get-WebhookEventPayload' -Option 'ReadOnly' -Scope 'Local'
Expand Down

0 comments on commit 2455184

Please sign in to comment.