Skip to content

Commit e7549a3

Browse files
committed
Fix style
1 parent 9c33a70 commit e7549a3

File tree

5 files changed

+29
-53
lines changed

5 files changed

+29
-53
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ body:
1919
description: "What versions are affected? Versions must be listed as supported in the Security Policy (/.github/SECURITY.md)."
2020
multiple: true
2121
options:
22+
- "v0.2.0"
2223
- "v0.1.0"
2324
validations:
2425
required: false

.github/workflows/publish-psg-module.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,32 @@ jobs:
1212
steps:
1313
- name: "Checkout Repository"
1414
uses: "actions/[email protected]"
15-
- name: "Modify PowerShell Gallery Installation Policy"
16-
id: "psgip"
15+
- name: "Modify PowerShell Repository"
16+
id: "modify-powershell-repository"
1717
run: |
18-
Write-Host -Object "::set-output name=installationpolicy::$((Get-PSRepository -Name PSGallery).InstallationPolicy)"
19-
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
18+
Write-Host -Object "::set-output name=installation-policy::$((Get-PSRepository -Name 'PSGallery').InstallationPolicy)"
19+
Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Trusted' -Verbose
2020
shell: "pwsh"
2121
- name: "Setup PowerShellGet"
2222
run: |
23-
if (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.2.5 -ErrorAction SilentlyContinue) {} else {
24-
Install-Module -AcceptLicense -Name PowerShellGet -Scope AllUsers -Verbose
23+
if (Get-InstalledModule -Name 'PowerShellGet' -MinimumVersion '2.2.5' -ErrorAction SilentlyContinue) {} else {
24+
Install-Module -Name 'PowerShellGet' -MinimumVersion '2.2.5' -Scope 'AllUsers' -AcceptLicense -Verbose
2525
}
2626
shell: "pwsh"
2727
- name: "Update PowerShell Modules"
2828
run: |
29-
Update-Module -AcceptLicense -Scope AllUsers -Verbose
29+
Update-Module -Scope 'AllUsers' -AcceptLicense -Verbose
3030
shell: "pwsh"
3131
- name: "Test Publish"
3232
run: |
33-
Publish-Module -Path .\hugoalh.GitHubActionsToolkit\ -NugetAPIKey 'GUID' -WhatIf -Verbose
33+
Publish-Module -Path '.\hugoalh.GitHubActionsToolkit\' -NugetAPIKey 'GUID' -WhatIf -Verbose
3434
shell: "pwsh"
3535
- name: "Publish"
3636
run: |
37-
Publish-Module -Path .\hugoalh.GitHubActionsToolkit\ -NugetAPIKey '${{secrets.POWERSHELLGALLERY_TOKEN}}' -Verbose
37+
Publish-Module -Path '.\hugoalh.GitHubActionsToolkit\' -NugetAPIKey '${{secrets.POWERSHELLGALLERY_TOKEN}}' -Verbose
3838
shell: "pwsh"
39-
- name: "Revert Modify PowerShell Gallery Installation Policy"
40-
if: "${{steps.psgip.outcome == 'success' && always()}}"
39+
- name: "Revert Modify PowerShell Repository"
40+
if: "${{steps.modify-powershell-repository.outcome == 'success' && always()}}"
4141
run: |
42-
Set-PSRepository -Name PSGallery -InstallationPolicy '${{steps.psgip.outputs.installationpolicy}}'
42+
Set-PSRepository -Name 'PSGallery' -InstallationPolicy '${{steps.modify-powershell-repository.outputs.installation-policy}}'
4343
shell: "pwsh"

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Scope Local
5454
- `Get-GHActionsIsDebug`
5555
- `Get-GHActionsState`
5656
- `Get-GHActionsWebhookEventPayload`
57-
- `Invoke-GHActionsScriptGroup`
5857
- `Set-GHActionsOutput`
5958
- `Set-GHActionsState`
6059
- `Write-GHActionsDebug`

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psd1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
RootModule = 'hugoalh.GitHubActionsToolkit.psm1'
44

55
# Version number of this module.
6-
ModuleVersion = '0.1.0'
6+
ModuleVersion = '0.2.0'
77

88
# Supported PSEditions
99
# CompatiblePSEditions = @()
@@ -74,7 +74,6 @@
7474
'Get-GHActionsIsDebug',
7575
'Get-GHActionsState',
7676
'Get-GHActionsWebhookEventPayload',
77-
'Invoke-GHActionsScriptGroup',
7877
'Set-GHActionsOutput',
7978
'Set-GHActionsState',
8079
'Write-GHActionsDebug',

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psm1

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ An internal function to validate environment variable.
3434
.PARAMETER InputObject
3535
Environment variable that need to validate.
3636
.OUTPUTS
37-
Boolean -or Void
37+
Boolean | Void
3838
#>
3939
function Test-GHActionsEnvironmentVariable {
4040
[CmdletBinding()]
@@ -70,7 +70,7 @@ function Write-GHActionsCommand {
7070
[string]$Result = "::$Command"
7171
if ($Properties.Count -gt 0) {
7272
$Result += " $($($Properties.GetEnumerator() | ForEach-Object -Process {
73-
"$($_.Name)=$(Format-GHActionsEscapeCharacters -InputObject $_.Value -Command)"
73+
return "$($_.Name)=$(Format-GHActionsEscapeCharacters -InputObject $_.Value -Command)"
7474
}) -join ',')"
7575
}
7676
$Result += "::$(Format-GHActionsEscapeCharacters -InputObject $Message)"
@@ -135,9 +135,9 @@ function Add-GHActionsEnvironmentVariable {
135135
}
136136
}
137137
end {
138-
Add-Content -Encoding utf8NoBOM -Path $env:GITHUB_ENV -Value "$($($Result.GetEnumerator() | ForEach-Object -Process {
139-
"$($_.Name)=$($_.Value)"
140-
}) -join "`n")"
138+
Add-Content -Path $env:GITHUB_ENV -Value "$($($Result.GetEnumerator() | ForEach-Object -Process {
139+
return "$($_.Name)=$($_.Value)"
140+
}) -join "`n")" -Encoding utf8NoBOM
141141
}
142142
}
143143
<#
@@ -159,7 +159,7 @@ function Add-GHActionsPATH {
159159
[string[]]$Result = @()
160160
}
161161
process {
162-
$Path.GetEnumerator() | ForEach-Object -Process {
162+
$Path | ForEach-Object -Process {
163163
if (Test-Path -Path $_ -IsValid) {
164164
$Result += $_
165165
} else {
@@ -168,7 +168,7 @@ function Add-GHActionsPATH {
168168
}
169169
}
170170
end {
171-
Add-Content -Encoding utf8NoBOM -Path $env:GITHUB_PATH -Value "$($Result -join "`n")"
171+
Add-Content -Path $env:GITHUB_PATH -Value "$($Result -join "`n")" -Encoding utf8NoBOM
172172
}
173173
}
174174
<#
@@ -292,7 +292,7 @@ Whether the input is require. If required and not present, will throw an error.
292292
.PARAMETER Trim
293293
Trim the input's value.
294294
.OUTPUTS
295-
Hashtable -or String
295+
Hashtable | String
296296
#>
297297
function Get-GHActionsInput {
298298
[CmdletBinding()]
@@ -305,7 +305,7 @@ function Get-GHActionsInput {
305305
[hashtable]$Result = @{}
306306
}
307307
process {
308-
$Name.GetEnumerator() | ForEach-Object -Process {
308+
$Name | ForEach-Object -Process {
309309
$InputValue = Get-ChildItem -Path "Env:\INPUT_$($_.ToUpper() -replace '[ \n\r]','_')" -ErrorAction SilentlyContinue
310310
if ($InputValue -eq $null) {
311311
if ($Require) {
@@ -354,7 +354,7 @@ Name of the state.
354354
.PARAMETER Trim
355355
Trim the state's value.
356356
.OUTPUTS
357-
Hashtable -or String
357+
Hashtable | String
358358
#>
359359
function Get-GHActionsState {
360360
[CmdletBinding()]
@@ -366,7 +366,7 @@ function Get-GHActionsState {
366366
[hashtable]$Result = @{}
367367
}
368368
process {
369-
$Name.GetEnumerator() | ForEach-Object -Process {
369+
$Name | ForEach-Object -Process {
370370
$StateValue = Get-ChildItem -Path "Env:\STATE_$($_.ToUpper() -replace '[ \n\r]','_')" -ErrorAction SilentlyContinue
371371
if ($StateValue -eq $null) {
372372
$Result[$_] = $StateValue
@@ -397,30 +397,7 @@ PSCustomObject
397397
function Get-GHActionsWebhookEventPayload {
398398
[CmdletBinding()]
399399
param ()
400-
return (Get-Content -Encoding utf8NoBOM -Path $env:GITHUB_EVENT_PATH -Raw | ConvertFrom-Json -Depth 100)
401-
}
402-
<#
403-
.SYNOPSIS
404-
Execute script block in a log group.
405-
.PARAMETER Title
406-
Title of the log group.
407-
.PARAMETER ScriptBlock
408-
Script block to execute in the log group.
409-
.OUTPUTS
410-
Any
411-
#>
412-
function Invoke-GHActionsScriptGroup {
413-
[CmdletBinding()]
414-
param(
415-
[Parameter(Mandatory = $true, Position = 0)][string]$Title,
416-
[Parameter(Mandatory = $true, Position = 1)][scriptblock]$ScriptBlock
417-
)
418-
Enter-GHActionsLogGroup -Title $Title
419-
try {
420-
return $ScriptBlock.Invoke()
421-
} finally {
422-
Exit-GHActionsLogGroup
423-
}
400+
return (Get-Content -Path $env:GITHUB_EVENT_PATH -Raw -Encoding utf8NoBOM | ConvertFrom-Json -Depth 100)
424401
}
425402
<#
426403
.SYNOPSIS
@@ -440,7 +417,7 @@ function Set-GHActionsOutput {
440417
[Parameter(Mandatory = $true, Position = 0)][string]$Name,
441418
[Parameter(Mandatory = $true, Position = 1)][string]$Value
442419
)
443-
Write-GHActionsCommand -Command 'set-output' -Message $Value -Properties @{'name' = $Name }
420+
Write-GHActionsCommand -Command 'set-output' -Message $Value -Properties @{ 'name' = $Name }
444421
}
445422
<#
446423
.SYNOPSIS
@@ -460,7 +437,7 @@ function Set-GHActionsState {
460437
[Parameter(Mandatory = $true, Position = 0)][string]$Name,
461438
[Parameter(Mandatory = $true, Position = 1)][string]$Value
462439
)
463-
Write-GHActionsCommand -Command 'save-state' -Message $Value -Properties @{'name' = $Name }
440+
Write-GHActionsCommand -Command 'save-state' -Message $Value -Properties @{ 'name' = $Name }
464441
}
465442
<#
466443
.SYNOPSIS
@@ -678,4 +655,4 @@ function Write-GHActionsWarning {
678655
}
679656
end {}
680657
}
681-
Export-ModuleMember -Function Add-GHActionsEnvironmentVariable, Add-GHActionsPATH, Add-GHActionsSecretMask, Disable-GHActionsCommandEcho, Disable-GHActionsProcessingCommand, Enable-GHActionsCommandEcho, Enable-GHActionsProcessingCommand, Enter-GHActionsLogGroup, Exit-GHActionsLogGroup, Get-GHActionsInput, Get-GHActionsIsDebug, Get-GHActionsState, Get-GHActionsWebhookEventPayload, Invoke-GHActionsScriptGroup, Set-GHActionsOutput, Set-GHActionsState, Write-GHActionsDebug, Write-GHActionsError, Write-GHActionsFail, Write-GHActionsNotice, Write-GHActionsWarning
658+
Export-ModuleMember -Function Add-GHActionsEnvironmentVariable, Add-GHActionsPATH, Add-GHActionsSecretMask, Disable-GHActionsCommandEcho, Disable-GHActionsProcessingCommand, Enable-GHActionsCommandEcho, Enable-GHActionsProcessingCommand, Enter-GHActionsLogGroup, Exit-GHActionsLogGroup, Get-GHActionsInput, Get-GHActionsIsDebug, Get-GHActionsState, Get-GHActionsWebhookEventPayload, Set-GHActionsOutput, Set-GHActionsState, Write-GHActionsDebug, Write-GHActionsError, Write-GHActionsFail, Write-GHActionsNotice, Write-GHActionsWarning

0 commit comments

Comments
 (0)