Skip to content

Commit be6a331

Browse files
committed
20230323C
1 parent bafd544 commit be6a331

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

hugoalh.GitHubActionsToolkit/module/step-summary.psm1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Function Add-StepSummary {
2424
)
2525
Process {
2626
If (![System.IO.Path]::IsPathFullyQualified($Env:GITHUB_STEP_SUMMARY)) {
27-
Write-Error -Message 'Unable to write the GitHub Actions step summary: Environment path `GITHUB_STEP_SUMMARY` is not defined!' -Category 'ResourceUnavailable'
27+
Write-Error -Message 'Unable to write the GitHub Actions step summary: Environment path `GITHUB_STEP_SUMMARY` is not defined or not contain a valid file path!' -Category 'ResourceUnavailable'
2828
Return
2929
}
3030
If ($Value.Count -igt 0) {
@@ -222,7 +222,7 @@ Function Get-StepSummary {
222222
[Parameter(Mandatory = $True, ParameterSetName = 'Sizes')][Alias('Size')][Switch]$Sizes
223223
)
224224
If (![System.IO.Path]::IsPathFullyQualified($Env:GITHUB_STEP_SUMMARY)) {
225-
Write-Error -Message 'Unable to get the GitHub Actions step summary: Environment path `GITHUB_STEP_SUMMARY` is not defined!' -Category 'ResourceUnavailable'
225+
Write-Error -Message 'Unable to get the GitHub Actions step summary: Environment path `GITHUB_STEP_SUMMARY` is not defined or not contain a valid file path!' -Category 'ResourceUnavailable'
226226
Return
227227
}
228228
Switch ($PSCmdlet.ParameterSetName) {
@@ -252,7 +252,7 @@ Function Remove-StepSummary {
252252
[OutputType([Void])]
253253
Param ()
254254
If (![System.IO.Path]::IsPathFullyQualified($Env:GITHUB_STEP_SUMMARY)) {
255-
Write-Error -Message 'Unable to remove the GitHub Actions step summary: Environment path `GITHUB_STEP_SUMMARY` is not defined!' -Category 'ResourceUnavailable'
255+
Write-Error -Message 'Unable to remove the GitHub Actions step summary: Environment path `GITHUB_STEP_SUMMARY` is not defined or not contain a valid file path!' -Category 'ResourceUnavailable'
256256
Return
257257
}
258258
Remove-Item -LiteralPath $Env:GITHUB_STEP_SUMMARY -Confirm:$False -ErrorAction 'Continue'
@@ -291,7 +291,7 @@ Function Set-StepSummary {
291291
}
292292
End {
293293
If (![System.IO.Path]::IsPathFullyQualified($Env:GITHUB_STEP_SUMMARY)) {
294-
Write-Error -Message 'Unable to write the GitHub Actions step summary: Environment path `GITHUB_STEP_SUMMARY` is not defined!' -Category 'ResourceUnavailable'
294+
Write-Error -Message 'Unable to write the GitHub Actions step summary: Environment path `GITHUB_STEP_SUMMARY` is not defined or not contain a valid file path!' -Category 'ResourceUnavailable'
295295
Return
296296
}
297297
If ($Result.Count -igt 0) {

hugoalh.GitHubActionsToolkit/module/utility.psm1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ Function Get-WebhookEventPayload {
7272
Param (
7373
[Alias('ToHashtable')][Switch]$AsHashtable
7474
)
75-
If ([String]::IsNullOrEmpty($Env:GITHUB_EVENT_PATH)) {
76-
Write-Error -Message 'Unable to get the GitHub Actions webhook event payload: Environment path `GITHUB_EVENT_PATH` is not defined!' -Category 'ResourceUnavailable'
75+
If ([System.IO.Path]::IsPathFullyQualified($Env:GITHUB_EVENT_PATH)) {
76+
Write-Error -Message 'Unable to get the GitHub Actions webhook event payload: Environment path `GITHUB_EVENT_PATH` is not defined or not contain a valid file path!' -Category 'ResourceUnavailable'
7777
Return
7878
}
7979
Get-Content -LiteralPath $Env:GITHUB_EVENT_PATH -Raw -Encoding 'UTF8NoBOM' |
@@ -97,7 +97,7 @@ Function Get-WorkflowRunUri {
9797
[OutputType([String])]
9898
Param ()
9999
ForEach ($EnvironmentPath In @('GITHUB_SERVER_URL', 'GITHUB_REPOSITORY', 'GITHUB_RUN_ID')) {
100-
If ([String]::IsNullOrEmpty((Get-Content -LiteralPath "Env:\$EnvironmentPath"))) {
100+
If ([String]::IsNullOrEmpty((Get-Content -LiteralPath "Env:\$EnvironmentPath" -ErrorAction 'SilentlyContinue'))) {
101101
Write-Error -Message "Unable to get the GitHub Actions workflow run URI: Environment path ``$EnvironmentPath`` is not defined!" -Category 'ResourceUnavailable'
102102
Return
103103
}

0 commit comments

Comments
 (0)