Skip to content

Commit ce004ad

Browse files
committed
20230312B
1 parent 856db32 commit ce004ad

File tree

15 files changed

+63
-73
lines changed

15 files changed

+63
-73
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ body:
1818
description: "What versions are affected? Versions must be listed as supported in the Security Policy (file: `SECURITY.md`)."
1919
multiple: true
2020
options:
21+
- "v1.3.0"
2122
- "v1.2.3"
2223
- "v1.2.2"
2324
- "v1.2.1"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Prefix 'GitHubActions' -Scop
7171
- `Find-GitHubActionsToolCache` 🔘
7272
- `Get-GitHubActionsInput`
7373
- `Get-GitHubActionsIsDebug`
74-
- `Get-GitHubActionsOpenIdConnectToken`
74+
- `Get-GitHubActionsOpenIdConnectToken` 🔘
7575
- `Get-GitHubActionsState`
7676
- `Get-GitHubActionsStepSummary`
7777
- `Get-GitHubActionsWebhookEventPayload`

SECURITY.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
1414
| **Versions** | **Status** | **Target - PowerShell** | **Target - NodeJS (Wrapper API)** | **Target - NPM (Wrapper API)** |
1515
|:-:|:-:|:-:|:-:|:-:|
16-
| v1.2.X | L | >= v7.2.0 | >= v14.15.0 | *N/A* |
17-
| v1.1.X || >= v7.2.0 | >= v14.15.0 | >= v6.14.8 |
16+
| v1.3.X | L | >= v7.2.0 | >= v14.15.0 | *N/A* |
17+
| v1.2.X | 👎{🐛} | >= v7.2.0 | >= v14.15.0 | *N/A* |
18+
| v1.1.X | 👎{🐛} | >= v7.2.0 | >= v14.15.0 | >= v6.14.8 |
1819
| v1.1.0 | ❌{🐛} | >= v7.2.0 | >= v14.15.0 | >= v6.14.8 |
1920
| v1.0.X | ❌{🐛🧓} | >= v7.2.0 | >= v14.15.0 | >= v6.14.8 |
2021
| v1.0.0 | ❌{🐛🧓} | >= v7.2.0 | >= v14.15.0 | >= v6.14.8 |

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psd1

Lines changed: 1 addition & 1 deletion
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 = '1.2.3'
6+
ModuleVersion = '1.3.0'
77

88
# Supported PSEditions
99
# CompatiblePSEditions = @()

hugoalh.GitHubActionsToolkit/module/artifact.psm1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,19 @@ Function Export-Artifact {
3939
[Parameter(ValueFromPipelineByPropertyName = $True)][Alias('RetentionDay')][Byte]$RetentionTime
4040
)
4141
Begin {
42-
<# [DISABLED] Issue in GitHub Actions runner
42+
<# [DISABLED] NodeJS wrapper operation
4343
[Boolean]$NoOperation = !(Test-GitHubActionsEnvironment -Artifact)# When the requirements are not fulfill, use this variable to skip this function but keep continue invoke the script.
44-
#>
4544
If ($NoOperation) {
4645
Write-Error -Message 'Unable to get GitHub Actions artifact resources!' -Category 'ResourceUnavailable'
4746
}
47+
#>
4848
}
4949
Process {
50+
<# [DISABLED] NodeJS wrapper operation
5051
If ($NoOperation) {
5152
Return
5253
}
54+
#>
5355
Switch ($PSCmdlet.ParameterSetName) {
5456
'LiteralPath' {
5557
[String[]]$PathsProceed = $LiteralPath |
@@ -109,17 +111,19 @@ Function Import-Artifact {
109111
[Parameter(ValueFromPipelineByPropertyName = $True)][Alias('Dest', 'Path', 'Target')][String]$Destination = $Env:GITHUB_WORKSPACE
110112
)
111113
Begin {
112-
<# [DISABLED] Issue in GitHub Actions runner
114+
<# [DISABLED] NodeJS wrapper operation
113115
[Boolean]$NoOperation = !(Test-GitHubActionsEnvironment -Artifact)# When the requirements are not fulfill, use this variable to skip this function but keep continue invoke the script.
114-
#>
115116
If ($NoOperation) {
116117
Write-Error -Message 'Unable to get GitHub Actions artifact resources!' -Category 'ResourceUnavailable'
117118
}
119+
#>
118120
}
119121
Process {
122+
<# [DISABLED] NodeJS wrapper operation
120123
If ($NoOperation) {
121124
Return
122125
}
126+
#>
123127
Switch ($PSCmdlet.ParameterSetName) {
124128
'All' {
125129
Invoke-GitHubActionsNodeJsWrapper -Name 'artifact/download-all' -InputObject ([PSCustomObject]@{

hugoalh.GitHubActionsToolkit/module/cache.psm1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,19 @@ Function Restore-Cache {
4343
[Parameter(ValueFromPipelineByPropertyName = $True)][Switch]$LookUp
4444
)
4545
Begin {
46-
<# [DISABLED] Issue in GitHub Actions runner
46+
<# [DISABLED] NodeJS wrapper operation
4747
[Boolean]$NoOperation = !(Test-GitHubActionsEnvironment -Cache)# When the requirements are not fulfill, use this variable to skip this function but keep continue invoke the script.
48-
#>
4948
If ($NoOperation) {
5049
Write-Error -Message 'Unable to get GitHub Actions cache resources!' -Category 'ResourceUnavailable'
5150
}
51+
#>
5252
}
5353
Process {
54+
<# [DISABLED] NodeJS wrapper operation
5455
If ($NoOperation) {
5556
Return
5657
}
58+
#>
5759
[Hashtable]$InputObject = @{
5860
PrimaryKey = $Key[0]
5961
Path = ($PSCmdlet.ParameterSetName -ieq 'LiteralPath') ? (
@@ -111,17 +113,19 @@ Function Save-Cache {
111113
[Parameter(ValueFromPipelineByPropertyName = $True)][ValidateRange(1, 16)][Alias('Concurrency')][Byte]$UploadConcurrency
112114
)
113115
Begin {
114-
<# [DISABLED] Issue in GitHub Actions runner
116+
<# [DISABLED] NodeJS wrapper operation
115117
[Boolean]$NoOperation = !(Test-GitHubActionsEnvironment -Cache)# When the requirements are not fulfill, use this variable to skip this function but keep continue invoke the script.
116-
#>
117118
If ($NoOperation) {
118119
Write-Error -Message 'Unable to get GitHub Actions cache resources!' -Category 'ResourceUnavailable'
119120
}
121+
#>
120122
}
121123
Process {
124+
<# [DISABLED] NodeJS wrapper operation
122125
If ($NoOperation) {
123126
Return
124127
}
128+
#>
125129
[Hashtable]$InputObject = @{
126130
Key = $Key
127131
Path = ($PSCmdlet.ParameterSetName -ieq 'LiteralPath') ? (

hugoalh.GitHubActionsToolkit/module/nodejs-invoke.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Function Invoke-NodeJsWrapper {
6363
Write-Output
6464
}
6565
Catch {
66-
Write-Error -Message "Unable to successfully invoke NodeJS wrapper ``$Name``! $_" -Category 'InvalidData'
66+
Write-Error -Message "Unable to successfully invoke NodeJS wrapper ``$Name``: $_" -Category 'InvalidData'
6767
}
6868
}
6969
Export-ModuleMember -Function @(

hugoalh.GitHubActionsToolkit/module/nodejs-wrapper/dist/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64431,7 +64431,7 @@ switch (wrapperName) {
6443164431
}
6443264432
break;
6443364433
default:
64434-
errorHandle(`\`${wrapperName}\` is not a known NodeJS wrapper name! This is most likely a mistake made by the contributors, please report with this information.`);
64434+
errorHandle(`\`${wrapperName}\` is not a valid NodeJS wrapper name! Most likely a mistake made by the contributors, please report this issue.`);
6443564435
break;
6443664436
}
6443764437

hugoalh.GitHubActionsToolkit/module/nodejs-wrapper/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hugoalh/ghactions-toolkit-powershell-nodejs-wrapper-distribution",
3-
"version": "1.2.3",
3+
"version": "1.3.0",
44
"description": "A PowerShell module to provide a better and easier way for GitHub Actions to communicate with the runner machine, and the toolkit for developing GitHub Actions in PowerShell.",
55
"keywords": [
66
"gh-actions",

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

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ GitHub Actions - Get OpenID Connect Token
1515
Interact with the GitHub OpenID Connect (OIDC) provider and get a JSON Web Token (JWT) ID token which would help to get access token from third party cloud providers.
1616
.PARAMETER Audience
1717
Audience.
18-
.PARAMETER UseNodeJsWrapper
19-
Whether to use NodeJS wrapper edition instead of PowerShell edition.
2018
.OUTPUTS
2119
[String] A JSON Web Token (JWT) ID token.
2220
#>
@@ -25,45 +23,28 @@ Function Get-OpenIdConnectToken {
2523
[OutputType([String])]
2624
Param (
2725
[Parameter(Position = 0, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)][String]$Audience,
28-
[Parameter(ValueFromPipelineByPropertyName = $True)][Alias('NodeJs', 'NodeJsWrapper', 'UseNodeJs')][Switch]$UseNodeJsWrapper
26+
[Parameter(ValueFromPipelineByPropertyName = $True)][Alias('NodeJs', 'NodeJsWrapper', 'UseNodeJs')][Switch]$UseNodeJsWrapper# Deprecated, keep as legacy.
2927
)
3028
Begin {
31-
<# [DISABLED] Issue in GitHub Actions runner
29+
<# [DISABLED] NodeJS wrapper operation
3230
[Boolean]$NoOperation = !(Test-GitHubActionsEnvironment -OpenIDConnect)# When the requirements are not fulfill, use this variable to skip this function but keep continue invoke the script.
33-
#>
3431
If ($NoOperation) {
3532
Write-Error -Message 'Unable to get GitHub Actions OpenID Connect (OIDC) resources!' -Category 'ResourceUnavailable'
3633
}
34+
#>
3735
}
3836
Process {
37+
<# [DISABLED] NodeJS wrapper operation
3938
If ($NoOperation) {
4039
Return
4140
}
42-
If ($UseNodeJsWrapper.IsPresent) {
43-
[Hashtable]$InputObject = @{}
44-
If ($Audience.Length -igt 0) {
45-
$InputObject.Audience = $Audience
46-
}
47-
(Invoke-GitHubActionsNodeJsWrapper -Name 'open-id-connect/get-token' -InputObject ([PSCustomObject]$InputObject))?.Token |
48-
Write-Output
49-
Return
50-
}
51-
[String]$RequestToken = $Env:ACTIONS_ID_TOKEN_REQUEST_TOKEN
52-
[String]$RequestUri = $Env:ACTIONS_ID_TOKEN_REQUEST_URL
53-
Add-GitHubActionsSecretMask -Value $RequestToken
41+
#>
42+
[Hashtable]$InputObject = @{}
5443
If ($Audience.Length -igt 0) {
55-
$RequestUri += "&audience=$([System.Web.HttpUtility]::UrlEncode($Audience))"
56-
}
57-
Write-GitHubActionsDebug -Message "OpenID Connect Token Request URI: $RequestUri"
58-
Try {
59-
[PSCustomObject]$Response = Invoke-WebRequest -Uri $RequestUri -UseBasicParsing -UserAgent 'actions/oidc-client' -Headers @{ Authorization = "Bearer $RequestToken" } -MaximumRedirection 1 -MaximumRetryCount 10 -RetryIntervalSec 10 -Method 'Get'
60-
[ValidateNotNullOrEmpty()][String]$OidcToken = (ConvertFrom-Json -InputObject $Response.Content -Depth 100).value
61-
Add-GitHubActionsSecretMask -Value $OidcToken
62-
Write-Output -InputObject $OidcToken
63-
}
64-
Catch {
65-
Write-Error @_
44+
$InputObject.Audience = $Audience
6645
}
46+
(Invoke-GitHubActionsNodeJsWrapper -Name 'open-id-connect/get-token' -InputObject ([PSCustomObject]$InputObject))?.Token |
47+
Write-Output
6748
}
6849
}
6950
Set-Alias -Name 'Get-OidcToken' -Value 'Get-OpenIdConnectToken' -Option 'ReadOnly' -Scope 'Local'

0 commit comments

Comments
 (0)