Skip to content

Commit c0e5097

Browse files
committed
20220911A
1 parent 82faacd commit c0e5097

19 files changed

+150
-201
lines changed

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ labels: "Status/Pending 🔵,Type/Bug 🐛"
66
> ### Suggested Content List
77
>
88
> - **Describe:** What the bug is?
9-
> - **Version:** What versions are affected? Versions must be listed as supported in the Security Policy (i.e.: file `SECURITY.md`).
9+
> - **Version:** What versions are affected? Versions must be listed as supported in the Security Policy (file: `SECURITY.md`).
1010
> - **To Reproduce:** If this bug can be reproduce, please list the steps!
1111
> - **Expected Behavior:** What things should expected to happen?
1212
>

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ body:
1515
id: "version"
1616
attributes:
1717
label: "Version"
18-
description: "What versions are affected? Versions must be listed as supported in the Security Policy (i.e.: file `SECURITY.md`)."
18+
description: "What versions are affected? Versions must be listed as supported in the Security Policy (file: `SECURITY.md`)."
1919
multiple: true
2020
options:
2121
- "v1.0.1"

hugoalh.GitHubActionsToolkit/_get-package-members.ps1

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
This script is help for copy members to the file `hugoalh.GitHubActionsToolkit.psd1` for best performance, and use for debug.
55
#>
66
[String]$PackageName = 'hugoalh.GitHubActionsToolkit'
7-
@(
8-
"$PackageName.psm1"
9-
) |
10-
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath $_ } |
11-
Import-Module -Scope 'Local'
7+
Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath "$PackageName.psm1") -Scope 'Local'
128
[PSCustomObject[]]$PackageCommands = Get-Command -Module $PackageName -ListImported
139
ForEach ($CommandType In @('Function', 'Alias')) {
1410
$PackageCommands |

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psm1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
'tool-cache',
1616
'utility'
1717
)
18-
$ModulesNames |
19-
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath 'module' -AdditionalChildPath "$_.psm1" } |
20-
Import-Module -Scope 'Local'
18+
Import-Module -Name (
19+
$ModulesNames |
20+
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath 'module' -AdditionalChildPath "$_.psm1" }
21+
) -Scope 'Local'
2122
[PSCustomObject[]]$PackageCommands = Get-Command -Module $ModulesNames -ListImported
2223
[String[]]$PackageCommandsFunctions = $PackageCommands |
2324
Where-Object -FilterScript { $_.CommandType -ieq 'Function' } |

hugoalh.GitHubActionsToolkit/module/artifact.psm1

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#Requires -PSEdition Core
22
#Requires -Version 7.2
3-
@(
4-
'nodejs-invoke.psm1',
5-
'utility.psm1'
6-
) |
7-
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath $_ } |
8-
Import-Module -Prefix 'GitHubActions' -Scope 'Local'
3+
Import-Module -Name (
4+
@(
5+
'nodejs-invoke.psm1',
6+
'utility.psm1'
7+
) |
8+
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath $_ }
9+
) -Prefix 'GitHubActions' -Scope 'Local'
910
<#
1011
.SYNOPSIS
1112
GitHub Actions - Export Artifact
@@ -51,21 +52,13 @@ Function Export-Artifact {
5152
Switch ($PSCmdlet.ParameterSetName) {
5253
'LiteralPath' {
5354
[String[]]$PathsProceed = $LiteralPath |
54-
ForEach-Object -Process {
55-
[System.IO.Path]::IsPathRooted($_) ?
56-
$_ :
57-
(Join-Path -Path $BaseRoot -ChildPath $_)
58-
}
55+
ForEach-Object -Process { [System.IO.Path]::IsPathRooted($_) ? $_ : (Join-Path -Path $BaseRoot -ChildPath $_) }
5956
}
6057
'Path' {
6158
[String[]]$PathsProceed = @()
6259
ForEach ($Item In $Path) {
6360
Try {
64-
$PathsProceed += [System.IO.Path]::IsPathRooted($Item) ?
65-
$Item :
66-
(Join-Path -Path $BaseRoot -ChildPath $Item)
67-
|
68-
Resolve-Path
61+
$PathsProceed += Resolve-Path -Path [System.IO.Path]::IsPathRooted($Item) ? $Item : (Join-Path -Path $BaseRoot -ChildPath $Item)
6962
}
7063
Catch {
7164
$PathsProceed += $Item

hugoalh.GitHubActionsToolkit/module/cache.psm1

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#Requires -PSEdition Core
22
#Requires -Version 7.2
3-
@(
4-
'nodejs-invoke.psm1',
5-
'utility.psm1'
6-
) |
7-
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath $_ } |
8-
Import-Module -Prefix 'GitHubActions' -Scope 'Local'
3+
Import-Module -Name (
4+
@(
5+
'nodejs-invoke.psm1',
6+
'utility.psm1'
7+
) |
8+
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath $_ }
9+
) -Prefix 'GitHubActions' -Scope 'Local'
910
<#
1011
.SYNOPSIS
1112
GitHub Actions - Restore Cache
@@ -61,11 +62,10 @@ Function Restore-Cache {
6162
PrimaryKey = $KeysProceed[0]
6263
RestoreKey = $KeysProceed |
6364
Select-Object -SkipIndex 0
64-
Path = ($PSCmdlet.ParameterSetName -ieq 'LiteralPath') ?
65-
($LiteralPath |
65+
Path = ($PSCmdlet.ParameterSetName -ieq 'LiteralPath') ? (
66+
$LiteralPath |
6667
ForEach-Object -Process { [WildcardPattern]::Escape($_) }
67-
) :
68-
$Path
68+
) : $Path
6969
UseAzureSdk = !$NotUseAzureSdk.IsPresent
7070
}
7171
If (!$NotUseAzureSdk.IsPresent) {
@@ -122,11 +122,10 @@ Function Save-Cache {
122122
}
123123
[Hashtable]$InputObject = @{
124124
Key = $Key
125-
Path = ($PSCmdlet.ParameterSetName -ieq 'LiteralPath') ?
126-
($LiteralPath |
125+
Path = ($PSCmdlet.ParameterSetName -ieq 'LiteralPath') ? (
126+
$LiteralPath |
127127
ForEach-Object -Process { [WildcardPattern]::Escape($_) }
128-
) :
129-
$Path
128+
) : $Path
130129
}
131130
If ($UploadChunkSizes -igt 0) {
132131
$InputObject.UploadChunkSizes = $UploadChunkSizes * 1KB

hugoalh.GitHubActionsToolkit/module/command-base.psm1

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,12 @@ Function Write-Command {
6868
[Parameter(ValueFromPipelineByPropertyName = $True)][Alias('Content', 'Message')][String]$Value
6969
)
7070
Process {
71-
"::$Command$(($Parameter.Count -igt 0) ?
72-
" $($Parameter.GetEnumerator() |
73-
Sort-Object -Property 'Name' |
74-
ForEach-Object -Process { "$($_.Name)=$(Format-CommandParameterValue -InputObject $_.Value)" } |
75-
Join-String -Separator ','
76-
)" :
77-
''
78-
)::$(Format-CommandValue -InputObject $Value)" |
79-
Write-Host
71+
Write-Host -Object "::$Command$(($Parameter.Count -igt 0) ? " $(
72+
$Parameter.GetEnumerator() |
73+
Sort-Object -Property 'Name' |
74+
ForEach-Object -Process { "$($_.Name)=$(Format-CommandParameterValue -InputObject $_.Value)" } |
75+
Join-String -Separator ','
76+
)" : '')::$(Format-CommandValue -InputObject $Value)"
8077
}
8178
}
8279
Export-ModuleMember -Function @(

hugoalh.GitHubActionsToolkit/module/command-control.psm1

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#Requires -PSEdition Core
22
#Requires -Version 7.2
3-
@(
4-
'command-base.psm1',
5-
'internal\token.psm1'
6-
) |
7-
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath $_ } |
8-
Import-Module -Prefix 'GitHubActions' -Scope 'Local'
3+
Import-Module -Name (
4+
@(
5+
'command-base.psm1',
6+
'internal\token.psm1'
7+
) |
8+
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath $_ }
9+
) -Prefix 'GitHubActions' -Scope 'Local'
910
[String[]]$GitHubActionsCommands = @(
1011
'add-mask',
1112
'add-matcher',
@@ -70,8 +71,7 @@ Function Disable-ProcessingCommands {
7071
[Parameter(Position = 0)][ValidateScript({ Test-ProcessingCommandsEndToken -InputObject $_ }, ErrorMessage = 'Parameter `EndToken` must be in single line string, more than or equal to 4 characters, not match any GitHub Actions commands, and unique!')][Alias('EndKey', 'EndValue', 'Key', 'Token', 'Value')][String]$EndToken = (New-CommandsEndToken)
7172
)
7273
Write-GitHubActionsCommand -Command 'stop-commands' -Value $EndToken
73-
$EndToken |
74-
Write-Output
74+
Write-Output -InputObject $EndToken
7575
}
7676
Set-Alias -Name 'Disable-CommandProcess' -Value 'Disable-ProcessingCommands' -Option 'ReadOnly' -Scope 'Local'
7777
Set-Alias -Name 'Disable-CommandProcessing' -Value 'Disable-ProcessingCommands' -Option 'ReadOnly' -Scope 'Local'
@@ -167,8 +167,7 @@ Function New-CommandsEndToken {
167167
}
168168
While ( $Result -iin $GitHubActionsCommandsEndTokensUsed )
169169
$Script:GitHubActionsCommandsEndTokensUsed += $Result
170-
$Result |
171-
Write-Output
170+
Write-Output -InputObject $Result
172171
}
173172
<#
174173
.SYNOPSIS

hugoalh.GitHubActionsToolkit/module/environment-variable.psm1

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#Requires -PSEdition Core
22
#Requires -Version 7.2
3-
@(
4-
'command-base.psm1'
5-
) |
6-
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath $_ } |
7-
Import-Module -Prefix 'GitHubActions' -Scope 'Local'
3+
Import-Module -Name (
4+
@(
5+
'command-base.psm1'
6+
) |
7+
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath $_ }
8+
) -Prefix 'GitHubActions' -Scope 'Local'
89
[Flags()] Enum GitHubActionsEnvironmentVariableScopes {
910
Current = 1
1011
Subsequent = 2
@@ -126,19 +127,11 @@ Function Set-EnvironmentVariable {
126127
Write-Error -Message 'Parameter `Value` must be in single line string!' -Category 'SyntaxError'
127128
Continue
128129
}
129-
$Result[
130-
$NoToUpper.IsPresent ?
131-
$Item.Name :
132-
$Item.Name.ToUpper()
133-
] = $Item.Value
130+
$Result[$NoToUpper.IsPresent ? $Item.Name : $Item.Name.ToUpper()] = $Item.Value
134131
}
135132
}
136133
'Single' {
137-
$Result[
138-
$NoToUpper.IsPresent ?
139-
$Name :
140-
$Name.ToUpper()
141-
] = $Value
134+
$Result[$NoToUpper.IsPresent ? $Name : $Name.ToUpper()] = $Value
142135
}
143136
}
144137
}

hugoalh.GitHubActionsToolkit/module/internal/token.psm1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#Requires -PSEdition Core
2+
#Requires -Version 7.2
13
[Char[]]$TokenPool = [String[]]@(0..9) + [Char[]]@(97..122)
24
<#
35
.SYNOPSIS
@@ -18,8 +20,7 @@ Function New-RandomToken {
1820
@(1..$Length) |
1921
ForEach-Object -Process {
2022
$TokenPool |
21-
Get-Random -Count 1 |
22-
Write-Output
23+
Get-Random -Count 1
2324
} |
2425
Join-String -Separator '' |
2526
Write-Output

0 commit comments

Comments
 (0)