Skip to content

Commit ab0537e

Browse files
committed
20230626A
1 parent d5d4814 commit ab0537e

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ Install-Module -Name 'hugoalh.GitHubActionsToolkit' -AcceptLicense
3333
```
3434

3535
```ps1
36-
<# Either #>
37-
Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Scope 'Local'# Recommend
38-
Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Prefix 'GitHubActions' -Scope 'Local'# Changeable Prefix
36+
Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Prefix 'GitHubActions' -Scope 'Local'
3937
```
4038

4139
### API

hugoalh.GitHubActionsToolkit/module/internal/new-random-token.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Requires -PSEdition Core -Version 7.2
2-
[Char[]]$PoolMain = [String[]]@(0..9) + [Char[]]@(65..90) + [Char[]]@(97..122)
2+
[Char[]]$Pool = [String[]]@(0..9) + [Char[]]@(65..90) + [Char[]]@(97..122)
33
<#
44
.SYNOPSIS
55
GitHub Actions - Internal - New Random Token
@@ -16,7 +16,7 @@ Function New-RandomToken {
1616
Param (
1717
[Parameter(Position = 0)][ValidateRange(1, [Int32]::MaxValue)][Int32]$Length = 32
1818
)
19-
[Char[]]$PoolCurrent = $PoolMain |
19+
[Char[]]$PoolCurrent = $Pool |
2020
Get-Random -Shuffle
2121
@(1..$Length) |
2222
ForEach-Object -Process {

hugoalh.GitHubActionsToolkit/module/nodejs-wrapper.psm1

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ Import-Module -Name (
55
) |
66
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath "$_.psm1" }
77
) -Prefix 'GitHubActions' -Scope 'Local'
8-
[SemVer]$NodeJsMinimumVersion = [SemVer]::Parse('14.15.0')
9-
[RegEx]$SemVerRegEx = 'v?\d+\.\d+\.\d+'
8+
[SemVer]$NodeJsVersionMinimum = [SemVer]::Parse('14.15.0')
109
[String]$WrapperRoot = Join-Path -Path $PSScriptRoot -ChildPath 'nodejs-wrapper'
1110
[String]$WrapperPackageFilePath = Join-Path -Path $WrapperRoot -ChildPath 'package.json'
1211
[String]$WrapperScriptFilePath = Join-Path -Path $WrapperRoot -ChildPath 'main.js'
@@ -134,6 +133,9 @@ Function Test-NodeJsEnvironment {
134133
[Alias('Redo')][Switch]$Retest,
135134
[Alias('Reinstall', 'ReinstallDependency', 'ReinstallPackage', 'ReinstallPackages')][Switch]$ReinstallDependencies# Deprecated, keep as legacy.
136135
)
136+
If ($PSBoundParameters.ContainsKey('ReinstallDependencies')) {
137+
Write-Warning -Message 'Parameter `ReinstallDependencies` is deprecated and will remove in the future version!'
138+
}
137139
If ($EnvironmentTested -and !$Retest.IsPresent) {
138140
Write-Verbose -Message 'Previously tested the NodeJS environment; Return the previous result.'
139141
Write-Output -InputObject $EnvironmentResult
@@ -149,12 +151,12 @@ Function Test-NodeJsEnvironment {
149151
Throw 'Unable to find NodeJS!'
150152
}
151153
Try {
152-
[String]$NodeJsVersionStdOut = node --no-deprecation --no-warnings --version |
153-
Join-String -Separator "`n"
154-
If (
155-
$NodeJsVersionStdOut -inotmatch $SemVerRegEx -or
156-
$NodeJsMinimumVersion -gt [SemVer]::Parse(($Matches[0] -ireplace '^v', ''))
157-
) {
154+
If ($NodeJsVersionMinimum -gt [SemVer]::Parse((
155+
node --no-deprecation --no-warnings --eval='console.log(JSON.stringify(process.versions));' |
156+
Join-String -Separator "`n" |
157+
ConvertFrom-Json -Depth 100 |
158+
Select-Object -ExpandProperty 'node'
159+
))) {
158160
Throw
159161
}
160162
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Function Get-OpenIdConnectToken {
2323
[Parameter(ValueFromPipelineByPropertyName = $True)][Alias('NodeJs', 'NodeJsWrapper', 'UseNodeJs')][Switch]$UseNodeJsWrapper# Deprecated, keep as legacy.
2424
)
2525
Process {
26+
If ($PSBoundParameters.ContainsKey('UseNodeJsWrapper')) {
27+
Write-Warning -Message 'Parameter `UseNodeJsWrapper` is deprecated and will remove in the future version!'
28+
}
2629
[Hashtable]$Argument = @{}
2730
If ($Audience.Length -gt 0) {
2831
$Argument.Audience = $Audience

hugoalh.GitHubActionsToolkit/module/utility.psm1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ Function Test-Environment {
137137
[Alias('RequiredMessage', 'RequireMessage')][String]$MandatoryMessage = 'This process requires to invoke inside the GitHub Actions environment!',
138138
[Switch]$StepSummary# Deprecated, keep as legacy.
139139
)
140+
If ($PSBoundParameters.ContainsKey('StepSummary')) {
141+
Write-Warning -Message 'Parameter `StepSummary` is deprecated and will remove in the future version!'
142+
}
140143
[Hashtable[]]$Conditions = @(
141144
@{ NeedTest = $True; Name = 'CI'; ExpectValue = 'true' },
142145
@{ NeedTest = $True; Name = 'GITHUB_ACTION'; },

0 commit comments

Comments
 (0)