File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed
hugoalh.GitHubActionsToolkit/module Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,10 @@ Function Save-Cache {
120
120
[ValidateRange (1 , 16 )][AllowNull ()][Byte ]$UploadConcurrency = $Null
121
121
)
122
122
Begin {
123
+ If (! (Test-GitHubActionsEnvironment - Cache)) {
124
+ Return (Write-Error - Message ' Unable to get GitHub Actions cache resources!' - Category ' ResourceUnavailable' )
125
+ Break # This is the best way to early terminate this function without terminate caller/invoker process.
126
+ }
123
127
[String []]$PathsProceed = @ ()
124
128
}
125
129
Process {
@@ -135,9 +139,6 @@ Function Save-Cache {
135
139
}
136
140
}
137
141
End {
138
- If (! (Test-GitHubActionsEnvironment - Cache)) {
139
- Return (Write-Error - Message ' Unable to get GitHub Actions cache resources!' - Category ' ResourceUnavailable' )
140
- }
141
142
If ($PathsProceed.Count -ieq 0 ) {
142
143
Return (Write-Error - Message ' No valid path is defined!' - Category ' NotSpecified' )
143
144
}
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ Function Add-StepSummary {
23
23
[Switch ]$NoNewLine
24
24
)
25
25
Begin {
26
+ If (! (Test-GitHubActionsEnvironment - StepSummary)) {
27
+ Return (Write-Error - Message ' Unable to get GitHub Actions step summary resources!' - Category ' ResourceUnavailable' )
28
+ Break # This is the best way to early terminate this function without terminate caller/invoker process.
29
+ }
26
30
[String []]$Result = @ ()
27
31
}
28
32
Process {
@@ -31,9 +35,6 @@ Function Add-StepSummary {
31
35
}
32
36
}
33
37
End {
34
- If (! (Test-GitHubActionsEnvironment - StepSummary)) {
35
- Return (Write-Error - Message ' Unable to get GitHub Actions step summary resources!' - Category ' ResourceUnavailable' )
36
- }
37
38
If ($Result.Count -igt 0 ) {
38
39
Add-Content - LiteralPath $Env: GITHUB_STEP_SUMMARY - Value ($Result -join " `n " ) - Confirm:$False - NoNewline:$NoNewLine.IsPresent - Encoding ' UTF8NoBOM'
39
40
}
@@ -271,6 +272,10 @@ Function Set-StepSummary {
271
272
[Switch ]$NoNewLine
272
273
)
273
274
Begin {
275
+ If (! (Test-GitHubActionsEnvironment - StepSummary)) {
276
+ Return (Write-Error - Message ' Unable to get GitHub Actions step summary resources!' - Category ' ResourceUnavailable' )
277
+ Break # This is the best way to early terminate this function without terminate caller/invoker process.
278
+ }
274
279
[String []]$Result = @ ()
275
280
}
276
281
Process {
@@ -279,9 +284,6 @@ Function Set-StepSummary {
279
284
}
280
285
}
281
286
End {
282
- If (! (Test-GitHubActionsEnvironment - StepSummary)) {
283
- Return (Write-Error - Message ' Unable to get GitHub Actions step summary resources!' - Category ' ResourceUnavailable' )
284
- }
285
287
If ($Result.Count -igt 0 ) {
286
288
Set-Content - LiteralPath $Env: GITHUB_STEP_SUMMARY - Value ($Result -join " `n " ) - Confirm:$False - NoNewline:$NoNewLine.IsPresent - Encoding ' UTF8NoBOM'
287
289
}
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ Function Invoke-ToolCacheToolDownloader {
114
114
Begin {
115
115
If (! (Test-GitHubActionsEnvironment - ToolCache)) {
116
116
Return (Write-Error - Message ' Unable to get GitHub Actions tool cache resources!' - Category ' ResourceUnavailable' )
117
+ Break # This is the best way to early terminate this function without terminate caller/invoker process.
117
118
}
118
119
[String []]$OutputObject = @ ()
119
120
}
You can’t perform that action at this time.
0 commit comments