Skip to content

Commit 280cbfb

Browse files
committed
20220620A
1 parent d2494b2 commit 280cbfb

File tree

5 files changed

+62
-62
lines changed

5 files changed

+62
-62
lines changed

hugoalh.GitHubActionsToolkit/module/environment-variable.psm1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ Function Add-PATH {
5050
[System.Environment]::SetEnvironmentVariable('PATH', ($PATHRaw -join [System.IO.Path]::PathSeparator))
5151
}
5252
{ $_ -icontains 'Subsequent' } {
53-
If ($null -ieq $env:GITHUB_PATH) {
53+
If ($Null -ieq $Env:GITHUB_PATH) {
5454
ForEach ($Item In $Result) {
5555
Write-GitHubActionsCommand -Command 'add-path' -Value $Item
5656
}
5757
} Else {
58-
Add-Content -LiteralPath $env:GITHUB_PATH -Value ($Result -join "`n") -Confirm:$False -Encoding 'UTF8NoBOM'
58+
Add-Content -LiteralPath $Env:GITHUB_PATH -Value ($Result -join "`n") -Confirm:$False -Encoding 'UTF8NoBOM'
5959
}
6060
}
6161
}
@@ -134,12 +134,12 @@ Function Set-EnvironmentVariable {
134134
}
135135
}
136136
{ $_ -icontains 'Subsequent' } {
137-
If ($null -ieq $env:GITHUB_ENV) {
137+
If ($Null -ieq $Env:GITHUB_ENV) {
138138
ForEach ($Item In $ResultEnumerator) {
139139
Write-GitHubActionsCommand -Command 'set-env' -Value $Item.Value -Parameter @{ 'name' = $Item.Name }
140140
}
141141
} Else {
142-
Add-Content -LiteralPath $env:GITHUB_ENV -Value (($ResultEnumerator | ForEach-Object -Process {
142+
Add-Content -LiteralPath $Env:GITHUB_ENV -Value (($ResultEnumerator | ForEach-Object -Process {
143143
Return "$($_.Name)=$($_.Value)"
144144
}) -join "`n") -Confirm:$False -Encoding 'UTF8NoBOM'
145145
}

hugoalh.GitHubActionsToolkit/module/open-id-connect.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Function Get-OpenIdConnectToken {
2323
If (!(Test-GitHubActionsEnvironment -OpenIDConnect)) {
2424
Return (Write-Error -Message 'Unable to get GitHub Actions OpenID Connect (OIDC) resources!' -Category 'ResourceUnavailable')
2525
}
26-
[String]$RequestToken = $env:ACTIONS_ID_TOKEN_REQUEST_TOKEN
27-
[String]$RequestUri = $env:ACTIONS_ID_TOKEN_REQUEST_URL
26+
[String]$RequestToken = $Env:ACTIONS_ID_TOKEN_REQUEST_TOKEN
27+
[String]$RequestUri = $Env:ACTIONS_ID_TOKEN_REQUEST_URL
2828
Add-GitHubActionsSecretMask -Value $RequestToken
2929
If ($Audience.Length -igt 0) {
3030
$RequestUri += "&audience=$([System.Web.HttpUtility]::UrlEncode($Audience))"

hugoalh.GitHubActionsToolkit/module/parameter.psm1

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Name of the inputs end with.
2222
.PARAMETER All
2323
Get all of the inputs.
2424
.PARAMETER EmptyStringAsNull
25-
Assume empty string of input's string as `$null`.
25+
Assume empty string of input's string as `$Null`.
2626
.PARAMETER Trim
2727
Trim the input's value.
2828
.OUTPUTS
@@ -49,7 +49,7 @@ Function Get-Input {
4949
Switch ($PSCmdlet.ParameterSetName) {
5050
'All' {
5151
ForEach ($Item In (Get-ChildItem -Path 'Env:\INPUT_*')) {
52-
If ($null -ieq $Item.Value) {
52+
If ($Null -ieq $Item.Value) {
5353
Continue
5454
}
5555
[String]$ItemValue = $Trim ? $Item.Value.Trim() : $Item.Value
@@ -62,24 +62,24 @@ Function Get-Input {
6262
}
6363
'One' {
6464
$InputValueRaw = Get-Content -LiteralPath "Env:\INPUT_$($Name.ToUpper())" -ErrorAction 'SilentlyContinue'
65-
If ($null -ieq $InputValueRaw) {
65+
If ($Null -ieq $InputValueRaw) {
6666
If ($Mandatory) {
6767
Return (Write-GitHubActionsFail -Message ($MandatoryMessage -f $Name))
6868
}
69-
Return $null
69+
Return $Null
7070
}
7171
[String]$InputValue = $Trim ? $InputValueRaw.Trim() : $InputValueRaw
7272
If ($EmptyStringAsNull -and $InputValue.Length -ieq 0) {
7373
If ($Mandatory) {
7474
Return (Write-GitHubActionsFail -Message ($MandatoryMessage -f $Name))
7575
}
76-
Return $null
76+
Return $Null
7777
}
7878
Return $InputValue
7979
}
8080
'Prefix' {
8181
ForEach ($Item In (Get-ChildItem -Path "Env:\INPUT_$($NamePrefix.ToUpper())*")) {
82-
If ($null -ieq $Item.Value) {
82+
If ($Null -ieq $Item.Value) {
8383
Continue
8484
}
8585
[String]$ItemValue = $Trim ? $Item.Value.Trim() : $Item.Value
@@ -92,7 +92,7 @@ Function Get-Input {
9292
}
9393
'Suffix' {
9494
ForEach ($Item In (Get-ChildItem -Path "Env:\INPUT_*$($NameSuffix.ToUpper())")) {
95-
If ($null -ieq $Item.Value) {
95+
If ($Null -ieq $Item.Value) {
9696
Continue
9797
}
9898
[String]$ItemValue = $Trim ? $Item.Value.Trim() : $Item.Value
@@ -125,7 +125,7 @@ Name of the states end with.
125125
.PARAMETER All
126126
Get all of the states.
127127
.PARAMETER EmptyStringAsNull
128-
Assume empty string of state's value as `$null`.
128+
Assume empty string of state's value as `$Null`.
129129
.PARAMETER Trim
130130
Trim the state's value.
131131
.OUTPUTS
@@ -150,7 +150,7 @@ Function Get-State {
150150
Switch ($PSCmdlet.ParameterSetName) {
151151
'All' {
152152
ForEach ($Item In (Get-ChildItem -Path 'Env:\STATE_*')) {
153-
If ($null -ieq $Item.Value) {
153+
If ($Null -ieq $Item.Value) {
154154
Continue
155155
}
156156
[String]$ItemValue = $Trim ? $Item.Value.Trim() : $Item.Value
@@ -163,18 +163,18 @@ Function Get-State {
163163
}
164164
'One' {
165165
$StateValueRaw = Get-Content -LiteralPath "Env:\STATE_$($Name.ToUpper())" -ErrorAction 'SilentlyContinue'
166-
If ($null -ieq $StateValueRaw) {
167-
Return $null
166+
If ($Null -ieq $StateValueRaw) {
167+
Return $Null
168168
}
169169
[String]$StateValue = $Trim ? $StateValueRaw.Trim() : $StateValueRaw
170170
If ($EmptyStringAsNull -and $StateValue.Length -ieq 0) {
171-
Return $null
171+
Return $Null
172172
}
173173
Return $StateValue
174174
}
175175
'Prefix' {
176176
ForEach ($Item In (Get-ChildItem -Path "Env:\STATE_$($NamePrefix.ToUpper())*")) {
177-
If ($null -ieq $Item.Value) {
177+
If ($Null -ieq $Item.Value) {
178178
Continue
179179
}
180180
[String]$ItemValue = $Trim ? $Item.Value.Trim() : $Item.Value
@@ -187,7 +187,7 @@ Function Get-State {
187187
}
188188
'Suffix' {
189189
ForEach ($Item In (Get-ChildItem -Path "Env:\STATE_*$($NameSuffix.ToUpper())")) {
190-
If ($null -ieq $Item.Value) {
190+
If ($Null -ieq $Item.Value) {
191191
Continue
192192
}
193193
[String]$ItemValue = $Trim ? $Item.Value.Trim() : $Item.Value

hugoalh.GitHubActionsToolkit/module/step-summary.psm1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Function Add-StepSummary {
2929
}
3030
End {
3131
If ($Result.Count -igt 0) {
32-
Add-Content -LiteralPath $env:GITHUB_STEP_SUMMARY -Value ($Result -join "`n") -Confirm:$False -NoNewline:$NoNewLine -Encoding 'UTF8NoBOM'
32+
Add-Content -LiteralPath $Env:GITHUB_STEP_SUMMARY -Value ($Result -join "`n") -Confirm:$False -NoNewline:$NoNewLine -Encoding 'UTF8NoBOM'
3333
}
3434
Return
3535
}
@@ -206,10 +206,10 @@ Function Get-StepSummary {
206206
)
207207
Switch ($PSCmdlet.ParameterSetName) {
208208
'Content' {
209-
Return (Get-Content -LiteralPath $env:GITHUB_STEP_SUMMARY -Raw:$Raw -Encoding 'UTF8NoBOM')
209+
Return (Get-Content -LiteralPath $Env:GITHUB_STEP_SUMMARY -Raw:$Raw -Encoding 'UTF8NoBOM')
210210
}
211211
'Sizes' {
212-
Return (Get-Item -LiteralPath $env:GITHUB_STEP_SUMMARY).Length
212+
Return (Get-Item -LiteralPath $Env:GITHUB_STEP_SUMMARY).Length
213213
}
214214
}
215215
}
@@ -225,7 +225,7 @@ Function Remove-StepSummary {
225225
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_remove-githubactionsstepsummary#Remove-GitHubActionsStepSummary')]
226226
[OutputType([Void])]
227227
Param ()
228-
Return (Remove-Item -LiteralPath $env:GITHUB_STEP_SUMMARY -Confirm:$False)
228+
Return (Remove-Item -LiteralPath $Env:GITHUB_STEP_SUMMARY -Confirm:$False)
229229
}
230230
<#
231231
.SYNOPSIS
@@ -256,7 +256,7 @@ Function Set-StepSummary {
256256
}
257257
End {
258258
If ($Result.Count -igt 0) {
259-
Set-Content -LiteralPath $env:GITHUB_STEP_SUMMARY -Value ($Result -join "`n") -Confirm:$False -NoNewline:$NoNewLine -Encoding 'UTF8NoBOM'
259+
Set-Content -LiteralPath $Env:GITHUB_STEP_SUMMARY -Value ($Result -join "`n") -Confirm:$False -NoNewline:$NoNewLine -Encoding 'UTF8NoBOM'
260260
}
261261
Return
262262
}

hugoalh.GitHubActionsToolkit/module/utility.psm1

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ Function Get-IsDebug {
5555
[OutputType([Boolean])]
5656
Param ()
5757
If (
58-
$env:RUNNER_DEBUG -ieq 'true' -or
59-
$env:RUNNER_DEBUG -ieq '1'
58+
$Env:RUNNER_DEBUG -ieq 'true' -or
59+
$Env:RUNNER_DEBUG -ieq '1'
6060
) {
6161
Return $True
6262
}
@@ -84,7 +84,7 @@ Function Get-WebhookEventPayload {
8484
[UInt16]$Depth = 1024,
8585
[Switch]$NoEnumerate
8686
)
87-
Return (Get-Content -LiteralPath $env:GITHUB_EVENT_PATH -Raw -Encoding 'UTF8NoBOM' | ConvertFrom-Json -AsHashtable:$AsHashtable -Depth $Depth -NoEnumerate:$NoEnumerate)
87+
Return (Get-Content -LiteralPath $Env:GITHUB_EVENT_PATH -Raw -Encoding 'UTF8NoBOM' | ConvertFrom-Json -AsHashtable:$AsHashtable -Depth $Depth -NoEnumerate:$NoEnumerate)
8888
}
8989
Set-Alias -Name 'Get-Event' -Value 'Get-WebhookEventPayload' -Option 'ReadOnly' -Scope 'Local'
9090
Set-Alias -Name 'Get-Payload' -Value 'Get-WebhookEventPayload' -Option 'ReadOnly' -Scope 'Local'
@@ -102,7 +102,7 @@ Function Get-WorkflowRunUri {
102102
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_get-githubactionsworkflowrunuri#Get-GitHubActionsWorkflowRunUri')]
103103
[OutputType([String])]
104104
Param ()
105-
Return "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
105+
Return "$Env:GITHUB_SERVER_URL/$Env:GITHUB_REPOSITORY/actions/runs/$Env:GITHUB_RUN_ID"
106106
}
107107
Set-Alias -Name 'Get-WorkflowRunUrl' -Value 'Get-WorkflowRunUri' -Option 'ReadOnly' -Scope 'Local'
108108
<#
@@ -126,39 +126,39 @@ Function Test-Environment {
126126
[Alias('RequiredMessage', 'RequireMessage')][String]$MandatoryMessage = 'This process require to execute inside the GitHub Actions environment!'
127127
)
128128
If (
129-
$env:CI -ine 'true' -or
130-
$null -ieq $env:GITHUB_ACTION_REPOSITORY -or
131-
$null -ieq $env:GITHUB_ACTION -or
132-
$null -ieq $env:GITHUB_ACTIONS -or
133-
$null -ieq $env:GITHUB_ACTOR -or
134-
$null -ieq $env:GITHUB_API_URL -or
135-
$null -ieq $env:GITHUB_ENV -or
136-
$null -ieq $env:GITHUB_EVENT_NAME -or
137-
$null -ieq $env:GITHUB_EVENT_PATH -or
138-
$null -ieq $env:GITHUB_GRAPHQL_URL -or
139-
$null -ieq $env:GITHUB_JOB -or
140-
$null -ieq $env:GITHUB_PATH -or
141-
$null -ieq $env:GITHUB_REF_NAME -or
142-
$null -ieq $env:GITHUB_REF_PROTECTED -or
143-
$null -ieq $env:GITHUB_REF_TYPE -or
144-
$null -ieq $env:GITHUB_REPOSITORY_OWNER -or
145-
$null -ieq $env:GITHUB_REPOSITORY -or
146-
$null -ieq $env:GITHUB_RETENTION_DAYS -or
147-
$null -ieq $env:GITHUB_RUN_ATTEMPT -or
148-
$null -ieq $env:GITHUB_RUN_ID -or
149-
$null -ieq $env:GITHUB_RUN_NUMBER -or
150-
$null -ieq $env:GITHUB_SERVER_URL -or
151-
$null -ieq $env:GITHUB_SHA -or
152-
$null -ieq $env:GITHUB_STEP_SUMMARY -or
153-
$null -ieq $env:GITHUB_WORKFLOW -or
154-
$null -ieq $env:GITHUB_WORKSPACE -or
155-
$null -ieq $env:RUNNER_ARCH -or
156-
$null -ieq $env:RUNNER_NAME -or
157-
$null -ieq $env:RUNNER_OS -or
158-
$null -ieq $env:RUNNER_TEMP -or
159-
$null -ieq $env:RUNNER_TOOL_CACHE -or
160-
($OpenIdConnect -and $null -ieq $env:ACTIONS_ID_TOKEN_REQUEST_TOKEN) -or
161-
($OpenIdConnect -and $null -ieq $env:ACTIONS_ID_TOKEN_REQUEST_URL)
129+
$Env:CI -ine 'true' -or
130+
$Null -ieq $Env:GITHUB_ACTION_REPOSITORY -or
131+
$Null -ieq $Env:GITHUB_ACTION -or
132+
$Null -ieq $Env:GITHUB_ACTIONS -or
133+
$Null -ieq $Env:GITHUB_ACTOR -or
134+
$Null -ieq $Env:GITHUB_API_URL -or
135+
$Null -ieq $Env:GITHUB_ENV -or
136+
$Null -ieq $Env:GITHUB_EVENT_NAME -or
137+
$Null -ieq $Env:GITHUB_EVENT_PATH -or
138+
$Null -ieq $Env:GITHUB_GRAPHQL_URL -or
139+
$Null -ieq $Env:GITHUB_JOB -or
140+
$Null -ieq $Env:GITHUB_PATH -or
141+
$Null -ieq $Env:GITHUB_REF_NAME -or
142+
$Null -ieq $Env:GITHUB_REF_PROTECTED -or
143+
$Null -ieq $Env:GITHUB_REF_TYPE -or
144+
$Null -ieq $Env:GITHUB_REPOSITORY_OWNER -or
145+
$Null -ieq $Env:GITHUB_REPOSITORY -or
146+
$Null -ieq $Env:GITHUB_RETENTION_DAYS -or
147+
$Null -ieq $Env:GITHUB_RUN_ATTEMPT -or
148+
$Null -ieq $Env:GITHUB_RUN_ID -or
149+
$Null -ieq $Env:GITHUB_RUN_NUMBER -or
150+
$Null -ieq $Env:GITHUB_SERVER_URL -or
151+
$Null -ieq $Env:GITHUB_SHA -or
152+
$Null -ieq $Env:GITHUB_STEP_SUMMARY -or
153+
$Null -ieq $Env:GITHUB_WORKFLOW -or
154+
$Null -ieq $Env:GITHUB_WORKSPACE -or
155+
$Null -ieq $Env:RUNNER_ARCH -or
156+
$Null -ieq $Env:RUNNER_NAME -or
157+
$Null -ieq $Env:RUNNER_OS -or
158+
$Null -ieq $Env:RUNNER_TEMP -or
159+
$Null -ieq $Env:RUNNER_TOOL_CACHE -or
160+
($OpenIdConnect -and $Null -ieq $Env:ACTIONS_ID_TOKEN_REQUEST_TOKEN) -or
161+
($OpenIdConnect -and $Null -ieq $Env:ACTIONS_ID_TOKEN_REQUEST_URL)
162162
) {
163163
If ($Mandatory) {
164164
Return (Write-GitHubActionsFail -Message $MandatoryMessage)

0 commit comments

Comments
 (0)