From 0a07b99b790e5834c6fff748fb148e4fbe201fbf Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:02:54 +0100 Subject: [PATCH 01/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20complex?= =?UTF-8?q?=20array=20output=20and=20JSON=20conversion=20to=20TestWorkflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index b6e1105..0d598d2 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -171,6 +171,45 @@ jobs: Set-GitHubOutput -Name 'Zen2' -Value $zen } + LogGroup 'Set array outputs' { + $complexArray = @( + [pscustomobject]@{ + Name = 'Test' + Value = 'Value' + Cars = @( + @{ + Make = 'Toyota' + Model = 'Corolla' + }, + @{ + Make = 'Ford' + Model = 'Fiesta' + } + ) + }, + [pscustomobject]@{ + Name = 'Test2' + Value = 'Value2' + Cars = @( + @{ + Make = 'Toyota' + Model = 'Corolla' + }, + @{ + Make = 'Ford' + Model = 'Fiesta' + } + ) + } + ) + Set-GitHubOutput -Name 'ComplexArray' -Value $complexArray + } + + LogGroup 'Set array outputs - JSON' { + $compexJson = $complexArray | ConvertTo-Json -Depth 10 + Set-GitHubOutput -Name 'ComplexArrayJson' -Value $compexJson + } + - name: Run-test shell: pwsh env: From 94a0a4ae6540e30df5470885409a2bfaf3b7d5f0 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:10:03 +0100 Subject: [PATCH 02/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20logging?= =?UTF-8?q?=20for=20JSON=20and=20object=20results=20in=20TestWorkflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 0d598d2..9562f5e 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -223,6 +223,14 @@ jobs: $result.Context | Format-List $result.GitConfig | Format-List + LogGroup 'Result - Json' { + $env:result + } + + LogGroup 'Result - Object' { + $result + } + ActionTestWithoutToken: name: WithoutToken runs-on: ${{ inputs.runs-on }} From 5c022f006ba3bf89ad8a93fd5deb4000e5d30496 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:18:55 +0100 Subject: [PATCH 03/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20additiona?= =?UTF-8?q?l=20environment=20variables=20for=20Zen=20and=20ComplexArray=20?= =?UTF-8?q?in=20TestWorkflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 9562f5e..5cf3182 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -215,6 +215,12 @@ jobs: env: result: ${{ steps.test.outputs.result }} WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} + Zen: ${{ fromJson(steps.test.outputs.result).Zen }} + Context: ${{ fromJson(steps.test.outputs.result).Context }} + GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} + Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} + ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} + ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | $result = $env:result | ConvertFrom-Json Set-GitHubStepSummary -Summary $env:WISECAT From cd0b45e8b4d380f9e7250b87a5ceefce250d449e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:23:34 +0100 Subject: [PATCH 04/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20push=20tr?= =?UTF-8?q?igger=20to=20Action-Test=20workflow=20and=20comment=20out=20unu?= =?UTF-8?q?sed=20output=20variables=20in=20TestWorkflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 1 + .github/workflows/TestWorkflow.yml | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index eb1c725..6072d09 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -4,6 +4,7 @@ run-name: "Action-Test - [${{ github.event.pull_request.title }} #${{ github.eve on: workflow_dispatch: + push: concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 5cf3182..4c602e3 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -216,11 +216,11 @@ jobs: result: ${{ steps.test.outputs.result }} WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} - Context: ${{ fromJson(steps.test.outputs.result).Context }} - GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} - Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} - ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} - ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} + # Context: ${{ fromJson(steps.test.outputs.result).Context }} + # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} + # Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} + # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} + # ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | $result = $env:result | ConvertFrom-Json Set-GitHubStepSummary -Summary $env:WISECAT From a5840503ce816b14df1506e629d60097339bc338 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:24:02 +0100 Subject: [PATCH 05/48] ``` No code changes made. ``` --- .github/workflows/Action-Test-Prerelease.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index 6072d09..07127c2 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -4,7 +4,7 @@ run-name: "Action-Test - [${{ github.event.pull_request.title }} #${{ github.eve on: workflow_dispatch: - push: + push: concurrency: group: ${{ github.workflow }}-${{ github.ref }} From e91ef7d811d442bf5aca2a250b737d8ee4e7fc22 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:25:15 +0100 Subject: [PATCH 06/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Uncomment=20out?= =?UTF-8?q?put=20variables=20for=20Context,=20GitConfig,=20and=20Zen2=20in?= =?UTF-8?q?=20TestWorkflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 4c602e3..79281c0 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -216,9 +216,9 @@ jobs: result: ${{ steps.test.outputs.result }} WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} - # Context: ${{ fromJson(steps.test.outputs.result).Context }} - # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} - # Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} + Context: ${{ fromJson(steps.test.outputs.result).Context }} + GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} + Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} # ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | From b7418bdfcd3c828b830cea84099c97515fb9f444 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:31:41 +0100 Subject: [PATCH 07/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20authen?= =?UTF-8?q?tication=20check=20in=20info.ps1=20to=20include=20provided=20to?= =?UTF-8?q?ken=20validation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/info.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/info.ps1 b/scripts/info.ps1 index d794019..7826521 100644 --- a/scripts/info.ps1 +++ b/scripts/info.ps1 @@ -28,7 +28,8 @@ process { $context = Get-GitHubContext $context | Format-List - if ($context.AuthType -ne 'APP') { + $providedToken = -not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token) + if ($context.AuthType -ne 'APP' -or -not $providedToken) { Write-Output 'GitHub CLI status:' gh auth status $LASTEXITCODE = 0 From 61ae7cb08fff96244bd8c89a94feeb5bac62945e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:31:45 +0100 Subject: [PATCH 08/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Refactor=20logg?= =?UTF-8?q?ing=20in=20TestWorkflow=20to=20enhance=20output=20clarity=20and?= =?UTF-8?q?=20structure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 41 ++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 79281c0..bfe50d0 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -223,11 +223,6 @@ jobs: # ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | $result = $env:result | ConvertFrom-Json - Set-GitHubStepSummary -Summary $env:WISECAT - Write-GitHubNotice -Message $result.Zen -Title 'GitHub Zen' - Write-Host ($result.Zen2) - $result.Context | Format-List - $result.GitConfig | Format-List LogGroup 'Result - Json' { $env:result @@ -237,6 +232,42 @@ jobs: $result } + LogGroup "WISECAT" { + Write-Host $env:WISECAT + } + + LogGroup "Zen" { + Write-Host $env:Zen + } + + LogGroup "Context" { + $env:Context | Format-List + } + + LogGroup "GitConfig" { + $env:GitConfig | Format-List + } + + LogGroup "Zen2" { + Write-Host $env:Zen2 + } + + LogGroup "ComplexArray" { + $env:ComplexArray | Format-List + } + + LogGroup "ComplexArrayJson" { + $env:ComplexArrayJson + } + + LogGroup "Other" { + Set-GitHubStepSummary -Summary $env:WISECAT + Write-GitHubNotice -Message $result.Zen -Title 'GitHub Zen' + Write-Host ($result.Zen2) + $result.Context | Format-List + $result.GitConfig | Format-List + } + ActionTestWithoutToken: name: WithoutToken runs-on: ${{ inputs.runs-on }} From a37995dd3a673c9d40227df67e522504cb8fdb8f Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:34:44 +0100 Subject: [PATCH 09/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Enhance=20TestW?= =?UTF-8?q?orkflow=20by=20adding=20summary=20logging=20and=20adjusting=20o?= =?UTF-8?q?utput=20variable=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index bfe50d0..f13b9e2 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -210,17 +210,21 @@ jobs: Set-GitHubOutput -Name 'ComplexArrayJson' -Value $compexJson } + LogGroup 'Set summary' { + Get-Content $env:GITHUB_OUTPUT -Raw | Set-GitHubStepSummary + } + - name: Run-test shell: pwsh env: result: ${{ steps.test.outputs.result }} WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} - Context: ${{ fromJson(steps.test.outputs.result).Context }} - GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} + # Context: ${{ fromJson(steps.test.outputs.result).Context }} + # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} - # ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} + ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | $result = $env:result | ConvertFrom-Json From 3598962085b7d5d849c14017090bae040f3d2143 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:39:01 +0100 Subject: [PATCH 10/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Uncomment=20Con?= =?UTF-8?q?text=20output=20variable=20in=20TestWorkflow=20for=20improved?= =?UTF-8?q?=20data=20accessibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index f13b9e2..1feeba3 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -220,7 +220,7 @@ jobs: result: ${{ steps.test.outputs.result }} WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} - # Context: ${{ fromJson(steps.test.outputs.result).Context }} + Context: ${{ fromJson(steps.test.outputs.result).Context }} # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} From d1cd0ea6f140bbb9161450549b0889660ac705be Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:43:30 +0100 Subject: [PATCH 11/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20Contex?= =?UTF-8?q?t=20output=20variable=20in=20TestWorkflow=20to=20include=20Clie?= =?UTF-8?q?ntID=20and=20improve=20authentication=20check=20in=20info.ps1?= =?UTF-8?q?=20for=20better=20token=20validation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- scripts/info.ps1 | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 1feeba3..d7b6411 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -220,7 +220,7 @@ jobs: result: ${{ steps.test.outputs.result }} WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} - Context: ${{ fromJson(steps.test.outputs.result).Context }} + Context: ${{ fromJson(steps.test.outputs.result).Context.CLientID }} # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} diff --git a/scripts/info.ps1 b/scripts/info.ps1 index 7826521..d07537f 100644 --- a/scripts/info.ps1 +++ b/scripts/info.ps1 @@ -28,10 +28,11 @@ process { $context = Get-GitHubContext $context | Format-List - $providedToken = -not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token) - if ($context.AuthType -ne 'APP' -or -not $providedToken) { + if ($context.AuthType -ne 'APP' -or [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) { Write-Output 'GitHub CLI status:' + Write-Warning "LASTEXITCODE: $LASTEXITCODE" gh auth status + Write-Warning "LASTEXITCODE has changed [$LASTEXITCODE]" $LASTEXITCODE = 0 } } From c61cf5eacbe88173080625b7f4679b0ee450e460 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:45:04 +0100 Subject: [PATCH 12/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20Contex?= =?UTF-8?q?t=20output=20variable=20in=20TestWorkflow=20to=20correctly=20pa?= =?UTF-8?q?rse=20ClientID=20from=20the=20result?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index d7b6411..589b0bb 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -220,7 +220,7 @@ jobs: result: ${{ steps.test.outputs.result }} WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} - Context: ${{ fromJson(steps.test.outputs.result).Context.CLientID }} + Context: ${{ fromJson(fromJson(steps.test.outputs.result).Context) }} # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} From c377933886c028c4fcb0e36dc51502d1da3023ca Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:47:41 +0100 Subject: [PATCH 13/48] Fix authentication check in info.ps1 to correctly handle LASTEXITCODE changes --- scripts/info.ps1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/info.ps1 b/scripts/info.ps1 index d07537f..98c2a00 100644 --- a/scripts/info.ps1 +++ b/scripts/info.ps1 @@ -28,12 +28,14 @@ process { $context = Get-GitHubContext $context | Format-List - if ($context.AuthType -ne 'APP' -or [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) { + if ($context.AuthType -ne 'APP' -and [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) { Write-Output 'GitHub CLI status:' - Write-Warning "LASTEXITCODE: $LASTEXITCODE" + $before = $LASTEXITCODE gh auth status - Write-Warning "LASTEXITCODE has changed [$LASTEXITCODE]" - $LASTEXITCODE = 0 + if ($LASTEXITCODE -ne $before) { + Write-Warning "LASTEXITCODE has changed [$LASTEXITCODE]" + $global:LASTEXITCODE = $before + } } } From af99a36386895688f328e67d146d52758b4c4c6f Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:52:25 +0100 Subject: [PATCH 14/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Improve=20authe?= =?UTF-8?q?ntication=20check=20in=20info.ps1=20to=20enhance=20token=20vali?= =?UTF-8?q?dation=20and=20output=20relevant=20context=20information?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/info.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/info.ps1 b/scripts/info.ps1 index 98c2a00..e9ee1ed 100644 --- a/scripts/info.ps1 +++ b/scripts/info.ps1 @@ -28,7 +28,11 @@ process { $context = Get-GitHubContext $context | Format-List - if ($context.AuthType -ne 'APP' -and [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) { + Write-Output "Token? [$([string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" + Write-Output "AuthType? [$($context.AuthType)]" + Write-Output "gh auth? [$($context.AuthType -ne 'APP' -or [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" + + if ($context.AuthType -ne 'APP' -or [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) { Write-Output 'GitHub CLI status:' $before = $LASTEXITCODE gh auth status From 800ef853ce398e7a4b292be67da90f6a5ab30960 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:53:19 +0100 Subject: [PATCH 15/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20Contex?= =?UTF-8?q?t=20output=20variable=20in=20TestWorkflow=20to=20use=20toJson?= =?UTF-8?q?=20for=20improved=20data=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 589b0bb..902181c 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -220,7 +220,7 @@ jobs: result: ${{ steps.test.outputs.result }} WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} - Context: ${{ fromJson(fromJson(steps.test.outputs.result).Context) }} + Context: ${{ toJson(fromJson(steps.test.outputs.result).Context) }} # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} From 4387446f78db039dd524d0defae89276f90bd008 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:53:23 +0100 Subject: [PATCH 16/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20GitCon?= =?UTF-8?q?fig=20output=20variable=20in=20TestWorkflow=20to=20use=20toJson?= =?UTF-8?q?=20for=20improved=20data=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 902181c..f26f2ea 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -221,7 +221,7 @@ jobs: WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} Context: ${{ toJson(fromJson(steps.test.outputs.result).Context) }} - # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} + GitConfig: ${{ toJson(fromJson(steps.test.outputs.result).GitConfig) }} Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} From 4391f50e1c25aafd7b25b85df540c720eb67c90b Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 22:57:31 +0100 Subject: [PATCH 17/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20Comple?= =?UTF-8?q?xArray=20output=20variable=20in=20TestWorkflow=20to=20use=20toJ?= =?UTF-8?q?son=20for=20improved=20data=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index f26f2ea..a4b6b7d 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -223,7 +223,7 @@ jobs: Context: ${{ toJson(fromJson(steps.test.outputs.result).Context) }} GitConfig: ${{ toJson(fromJson(steps.test.outputs.result).GitConfig) }} Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} - # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} + ComplexArray: ${{ toJson(fromJson(steps.test.outputs.result).ComplexArray) }} ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | $result = $env:result | ConvertFrom-Json From 8b1b8d9f724decfaf53d3585cf4b55333d58b90e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 23:30:18 +0100 Subject: [PATCH 18/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Refactor=20Test?= =?UTF-8?q?Workflow=20to=20remove=20unnecessary=20toJson=20calls=20and=20e?= =?UTF-8?q?nhance=20output=20handling;=20improve=20authentication=20check?= =?UTF-8?q?=20in=20info.ps1=20for=20accurate=20token=20validation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 6 +++--- scripts/info.ps1 | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index a4b6b7d..b3ce208 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -220,10 +220,10 @@ jobs: result: ${{ steps.test.outputs.result }} WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} - Context: ${{ toJson(fromJson(steps.test.outputs.result).Context) }} - GitConfig: ${{ toJson(fromJson(steps.test.outputs.result).GitConfig) }} + Context: ${{ fromJson(steps.test.outputs.result).Context }} + GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} - ComplexArray: ${{ toJson(fromJson(steps.test.outputs.result).ComplexArray) }} + ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | $result = $env:result | ConvertFrom-Json diff --git a/scripts/info.ps1 b/scripts/info.ps1 index e9ee1ed..dc48903 100644 --- a/scripts/info.ps1 +++ b/scripts/info.ps1 @@ -29,10 +29,10 @@ process { $context | Format-List Write-Output "Token? [$([string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" - Write-Output "AuthType? [$($context.AuthType)]" - Write-Output "gh auth? [$($context.AuthType -ne 'APP' -or [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" + Write-Output "AuthType? [$($context.AuthType)] - [$($context.AuthType -ne 'APP')]" + Write-Output "gh auth? [$($context.AuthType -ne 'APP' -and [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" - if ($context.AuthType -ne 'APP' -or [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) { + if ($context.AuthType -ne 'APP' -and [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) { Write-Output 'GitHub CLI status:' $before = $LASTEXITCODE gh auth status From 1cef44ab554df006b2c34d2ff60c7b11304cc203 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 23:31:29 +0100 Subject: [PATCH 19/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Comment=20out?= =?UTF-8?q?=20unused=20output=20variables=20in=20TestWorkflow=20for=20clea?= =?UTF-8?q?ner=20code=20and=20improved=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index b3ce208..165d340 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -220,11 +220,11 @@ jobs: result: ${{ steps.test.outputs.result }} WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} - Context: ${{ fromJson(steps.test.outputs.result).Context }} - GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} - ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} - ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} + # Context: ${{ fromJson(steps.test.outputs.result).Context }} + # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} + # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} + # ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | $result = $env:result | ConvertFrom-Json From eb5d8946cd26a78db4161e8b6759e0d5cd345559 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 23:33:51 +0100 Subject: [PATCH 20/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Fix=20logic=20i?= =?UTF-8?q?n=20info.ps1=20for=20accurate=20GitHub=20CLI=20authentication?= =?UTF-8?q?=20check;=20update=20TestWorkflow=20to=20correctly=20reference?= =?UTF-8?q?=20ComplexArrayJson=20output=20variable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- scripts/info.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 165d340..4ae7270 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -224,7 +224,7 @@ jobs: # Context: ${{ fromJson(steps.test.outputs.result).Context }} # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} - # ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} + ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | $result = $env:result | ConvertFrom-Json diff --git a/scripts/info.ps1 b/scripts/info.ps1 index dc48903..17632de 100644 --- a/scripts/info.ps1 +++ b/scripts/info.ps1 @@ -30,9 +30,9 @@ process { Write-Output "Token? [$([string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" Write-Output "AuthType? [$($context.AuthType)] - [$($context.AuthType -ne 'APP')]" - Write-Output "gh auth? [$($context.AuthType -ne 'APP' -and [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" + Write-Output "gh auth? [$($context.AuthType -ne 'APP' -and -not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" - if ($context.AuthType -ne 'APP' -and [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) { + if ($context.AuthType -ne 'APP' -and -not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) { Write-Output 'GitHub CLI status:' $before = $LASTEXITCODE gh auth status From 22afc77529b038834d18f70cc018f25783a1b41a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 24 Feb 2025 23:36:23 +0100 Subject: [PATCH 21/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Uncomment=20Com?= =?UTF-8?q?plexArray=20output=20variable=20in=20TestWorkflow=20for=20impro?= =?UTF-8?q?ved=20data=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 4ae7270..8a241be 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -223,7 +223,7 @@ jobs: Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} # Context: ${{ fromJson(steps.test.outputs.result).Context }} # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} - # ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} + ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | $result = $env:result | ConvertFrom-Json From efec0dc537c3ddf792a3793c9821dcd874ce908d Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:10:37 +0100 Subject: [PATCH 22/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20MatrixTes?= =?UTF-8?q?t=20output=20to=20ActionTestCommands=20and=20implement=20matrix?= =?UTF-8?q?=20strategy=20for=20dynamic=20testing=20across=20different=20en?= =?UTF-8?q?vironments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 64 ++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 8a241be..9f14bf0 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -130,6 +130,8 @@ jobs: ActionTestCommands: name: Commands + Outputs runs-on: ${{ inputs.runs-on }} + outputs: + MatrixTest: ${{ fromJson(steps.test.outputs.result).MatrixTest }} steps: # Need to check out as part of the test, as its a local action - name: Checkout repo @@ -214,6 +216,53 @@ jobs: Get-Content $env:GITHUB_OUTPUT -Raw | Set-GitHubStepSummary } + LogGroup 'MatrixTest' { + $matrixTest = @( + [pscustomobject]@{ + Name = 'Test' + RunsOn = 'ubuntu-latest' + Cars = @( + @{ + Make = 'Toyota' + Model = 'Corolla' + }, + @{ + Make = 'Ford' + Model = 'Fiesta' + } + ) + }, + [pscustomobject]@{ + Name = 'Test2' + RunsOn = 'windows-latest' + Cars = @( + @{ + Make = 'Toyota' + Model = 'Corolla' + }, + @{ + Make = 'Ford' + Model = 'Fiesta' + } + ) + },[pscustomobject]@{ + Name = 'Test3' + RunsOn = 'macos-latest' + Cars = @( + @{ + Make = 'Toyota' + Model = 'Corolla' + }, + @{ + Make = 'Ford' + Model = 'Fiesta' + } + ) + } + ) + Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest + } + - name: Run-test shell: pwsh env: @@ -272,6 +321,21 @@ jobs: $result.GitConfig | Format-List } + MatrixTest: + needs: ActionTestCommands + strategy: + matrix: ${{ needs.ActionTestCommands.outputs.MatrixTest }} + name: Matrix Test [${{ matrix.Name }}] + runs-on: ${{ matrix.RunsOn }} + steps: + - name: Matrix Test + shell: pwsh + env: + MatrixTest: ${{ matrix.Cars }} + run: | + $matrixTest = $env:MatrixTest | ConvertFrom-Json + $matrixTest | Format-List + ActionTestWithoutToken: name: WithoutToken runs-on: ${{ inputs.runs-on }} From 2d4b8bb92f86aacb8487d1b9785d8b7428218a0a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:17:11 +0100 Subject: [PATCH 23/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Simplify=20Matr?= =?UTF-8?q?ixTest=20configuration=20in=20TestWorkflow=20by=20removing=20re?= =?UTF-8?q?dundant=20Cars=20property=20and=20ensuring=20consistent=20Path?= =?UTF-8?q?=20assignment;=20uncomment=20Context=20and=20GitConfig=20output?= =?UTF-8?q?s=20for=20improved=20data=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 46 +++++++----------------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 9f14bf0..e248fcc 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -219,45 +219,19 @@ jobs: LogGroup 'MatrixTest' { $matrixTest = @( [pscustomobject]@{ - Name = 'Test' + Name = 'Test' RunsOn = 'ubuntu-latest' - Cars = @( - @{ - Make = 'Toyota' - Model = 'Corolla' - }, - @{ - Make = 'Ford' - Model = 'Fiesta' - } - ) + Path = 'test' }, [pscustomobject]@{ - Name = 'Test2' + Name = 'Test2' RunsOn = 'windows-latest' - Cars = @( - @{ - Make = 'Toyota' - Model = 'Corolla' - }, - @{ - Make = 'Ford' - Model = 'Fiesta' - } - ) - },[pscustomobject]@{ - Name = 'Test3' + Path = 'test' + }, + [pscustomobject]@{ + Name = 'Test3' RunsOn = 'macos-latest' - Cars = @( - @{ - Make = 'Toyota' - Model = 'Corolla' - }, - @{ - Make = 'Ford' - Model = 'Fiesta' - } - ) + Path = 'test' } ) Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest @@ -270,8 +244,8 @@ jobs: WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} Zen: ${{ fromJson(steps.test.outputs.result).Zen }} Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} - # Context: ${{ fromJson(steps.test.outputs.result).Context }} - # GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} + Context: ${{ fromJson(steps.test.outputs.result).Context }} + GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} run: | From 5566dc17dfa88c8a65d00e3f01e99216d8394620 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:24:04 +0100 Subject: [PATCH 24/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Refactor=20Matr?= =?UTF-8?q?ixTest=20configuration=20in=20TestWorkflow=20to=20use=20a=20has?= =?UTF-8?q?htable=20for=20improved=20structure=20and=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 36 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index e248fcc..c8a7a84 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -217,23 +217,25 @@ jobs: } LogGroup 'MatrixTest' { - $matrixTest = @( - [pscustomobject]@{ - Name = 'Test' - RunsOn = 'ubuntu-latest' - Path = 'test' - }, - [pscustomobject]@{ - Name = 'Test2' - RunsOn = 'windows-latest' - Path = 'test' - }, - [pscustomobject]@{ - Name = 'Test3' - RunsOn = 'macos-latest' - Path = 'test' - } - ) + $matrixTest = @{ + Include = @( + [pscustomobject]@{ + Name = 'Test' + RunsOn = 'ubuntu-latest' + Path = 'test' + }, + [pscustomobject]@{ + Name = 'Test2' + RunsOn = 'windows-latest' + Path = 'test' + }, + [pscustomobject]@{ + Name = 'Test3' + RunsOn = 'macos-latest' + Path = 'test' + } + ) + } Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest } From bdca73a55e171125bec991ccc6a7734d20897b29 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:27:38 +0100 Subject: [PATCH 25/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Correct=20casin?= =?UTF-8?q?g=20of=20'Include'=20to=20'include'=20in=20MatrixTest=20configu?= =?UTF-8?q?ration=20for=20consistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index c8a7a84..bf93f61 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -218,7 +218,7 @@ jobs: LogGroup 'MatrixTest' { $matrixTest = @{ - Include = @( + include = @( [pscustomobject]@{ Name = 'Test' RunsOn = 'ubuntu-latest' From 64103ac5ad8a98f2c0ec6a2e76ff9fbf3899b625 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:30:08 +0100 Subject: [PATCH 26/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20Action?= =?UTF-8?q?-Test=20workflow=20to=20implement=20matrix=20strategy=20for=20d?= =?UTF-8?q?ynamic=20testing=20and=20enhance=20output=20handling=20in=20Mat?= =?UTF-8?q?rixTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 202 ++++++++++++++++++- 1 file changed, 193 insertions(+), 9 deletions(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index 07127c2..bdd362b 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -15,13 +15,197 @@ permissions: pull-requests: read jobs: - ActionTest: - uses: ./.github/workflows/TestWorkflow.yml - secrets: inherit + # ActionTest: + # uses: ./.github/workflows/TestWorkflow.yml + # secrets: inherit + # strategy: + # fail-fast: false + # matrix: + # os: [ubuntu-latest, macos-latest, windows-latest] + # with: + # runs-on: ${{ matrix.os }} + # Prerelease: true + ActionTestCommands: + name: Commands + Outputs + runs-on: ubuntu-latest + outputs: + MatrixTest: ${{ fromJson(steps.test.outputs.result).MatrixTest }} + steps: + # Need to check out as part of the test, as its a local action + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Action-Test + uses: ./ + id: test + with: + Debug: true + Verbose: true + Prerelease: ${{ inputs.Prerelease }} + ShowInit: true + ShowOutput: true + Script: | + LogGroup 'Get-GitHubZen' { + $cat = Get-GitHubOctocat + $zen = Get-GitHubZen + Set-GitHubEnvironmentVariable -Name 'OCTOCAT' -Value $cat + } + + LogGroup 'Set outputs - WISECAT' { + Set-GitHubOutput -Name 'WISECAT' -Value $cat + } + + LogGroup 'Set outputs - Zen' { + Set-GitHubOutput -Name 'Zen' -Value $zen + } + + LogGroup 'Set outputs - Context' { + Set-GitHubOutput -Name 'Context' -Value (Get-GitHubContext) + } + + LogGroup 'Set outputs - GitConfig' { + Set-GitHubOutput -Name 'GitConfig' -Value (Get-GitHubGitConfig -Scope system) + } + + LogGroup 'Set outputs - Zen2' { + Set-GitHubOutput -Name 'Zen2' -Value $zen + } + + LogGroup 'Set array outputs' { + $complexArray = @( + [pscustomobject]@{ + Name = 'Test' + Value = 'Value' + Cars = @( + @{ + Make = 'Toyota' + Model = 'Corolla' + }, + @{ + Make = 'Ford' + Model = 'Fiesta' + } + ) + }, + [pscustomobject]@{ + Name = 'Test2' + Value = 'Value2' + Cars = @( + @{ + Make = 'Toyota' + Model = 'Corolla' + }, + @{ + Make = 'Ford' + Model = 'Fiesta' + } + ) + } + ) + Set-GitHubOutput -Name 'ComplexArray' -Value $complexArray + } + + LogGroup 'Set array outputs - JSON' { + $compexJson = $complexArray | ConvertTo-Json -Depth 10 + Set-GitHubOutput -Name 'ComplexArrayJson' -Value $compexJson + } + + LogGroup 'Set summary' { + Get-Content $env:GITHUB_OUTPUT -Raw | Set-GitHubStepSummary + } + + LogGroup 'MatrixTest' { + $matrixTest = @{ + include = @( + [pscustomobject]@{ + Name = 'Test' + RunsOn = 'ubuntu-latest' + Path = 'test' + }, + [pscustomobject]@{ + Name = 'Test2' + RunsOn = 'windows-latest' + Path = 'test' + }, + [pscustomobject]@{ + Name = 'Test3' + RunsOn = 'macos-latest' + Path = 'test' + } + ) + } + Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest + } + + - name: Run-test + shell: pwsh + env: + result: ${{ steps.test.outputs.result }} + WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} + Zen: ${{ fromJson(steps.test.outputs.result).Zen }} + Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} + Context: ${{ fromJson(steps.test.outputs.result).Context }} + GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} + ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} + ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} + run: | + $result = $env:result | ConvertFrom-Json + + LogGroup 'Result - Json' { + $env:result + } + + LogGroup 'Result - Object' { + $result + } + + LogGroup "WISECAT" { + Write-Host $env:WISECAT + } + + LogGroup "Zen" { + Write-Host $env:Zen + } + + LogGroup "Context" { + $env:Context | Format-List + } + + LogGroup "GitConfig" { + $env:GitConfig | Format-List + } + + LogGroup "Zen2" { + Write-Host $env:Zen2 + } + + LogGroup "ComplexArray" { + $env:ComplexArray | Format-List + } + + LogGroup "ComplexArrayJson" { + $env:ComplexArrayJson + } + + LogGroup "Other" { + Set-GitHubStepSummary -Summary $env:WISECAT + Write-GitHubNotice -Message $result.Zen -Title 'GitHub Zen' + Write-Host ($result.Zen2) + $result.Context | Format-List + $result.GitConfig | Format-List + } + + MatrixTest: + needs: ActionTestCommands strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - with: - runs-on: ${{ matrix.os }} - Prerelease: true + matrix: ${{ needs.ActionTestCommands.outputs.MatrixTest }} + name: Matrix Test [${{ matrix.Name }}] + runs-on: ${{ matrix.RunsOn }} + steps: + - name: Matrix Test + shell: pwsh + env: + MatrixTest: ${{ matrix.Cars }} + run: | + $matrixTest = $env:MatrixTest | ConvertFrom-Json + $matrixTest | Format-List From a5989b0528aefbe6346e21d5dfbf04f602865348 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:44:21 +0100 Subject: [PATCH 27/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20Action?= =?UTF-8?q?-Test=20workflow=20to=20set=20Prerelease=20to=20true=20and=20st?= =?UTF-8?q?reamline=20MatrixTest=20configuration=20by=20removing=20unneces?= =?UTF-8?q?sary=20output=20settings=20and=20simplifying=20array=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 142 +------------------ 1 file changed, 7 insertions(+), 135 deletions(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index bdd362b..4114785 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -41,164 +41,36 @@ jobs: with: Debug: true Verbose: true - Prerelease: ${{ inputs.Prerelease }} + Prerelease: true ShowInit: true ShowOutput: true Script: | - LogGroup 'Get-GitHubZen' { - $cat = Get-GitHubOctocat - $zen = Get-GitHubZen - Set-GitHubEnvironmentVariable -Name 'OCTOCAT' -Value $cat - } - - LogGroup 'Set outputs - WISECAT' { - Set-GitHubOutput -Name 'WISECAT' -Value $cat - } - - LogGroup 'Set outputs - Zen' { - Set-GitHubOutput -Name 'Zen' -Value $zen - } - - LogGroup 'Set outputs - Context' { - Set-GitHubOutput -Name 'Context' -Value (Get-GitHubContext) - } - - LogGroup 'Set outputs - GitConfig' { - Set-GitHubOutput -Name 'GitConfig' -Value (Get-GitHubGitConfig -Scope system) - } - - LogGroup 'Set outputs - Zen2' { - Set-GitHubOutput -Name 'Zen2' -Value $zen - } - - LogGroup 'Set array outputs' { - $complexArray = @( - [pscustomobject]@{ - Name = 'Test' - Value = 'Value' - Cars = @( - @{ - Make = 'Toyota' - Model = 'Corolla' - }, - @{ - Make = 'Ford' - Model = 'Fiesta' - } - ) - }, - [pscustomobject]@{ - Name = 'Test2' - Value = 'Value2' - Cars = @( - @{ - Make = 'Toyota' - Model = 'Corolla' - }, - @{ - Make = 'Ford' - Model = 'Fiesta' - } - ) - } - ) - Set-GitHubOutput -Name 'ComplexArray' -Value $complexArray - } - - LogGroup 'Set array outputs - JSON' { - $compexJson = $complexArray | ConvertTo-Json -Depth 10 - Set-GitHubOutput -Name 'ComplexArrayJson' -Value $compexJson - } - - LogGroup 'Set summary' { - Get-Content $env:GITHUB_OUTPUT -Raw | Set-GitHubStepSummary - } - LogGroup 'MatrixTest' { $matrixTest = @{ + Path = 'test' include = @( - [pscustomobject]@{ + @{ Name = 'Test' RunsOn = 'ubuntu-latest' - Path = 'test' }, - [pscustomobject]@{ + @{ Name = 'Test2' RunsOn = 'windows-latest' - Path = 'test' }, - [pscustomobject]@{ + @{ Name = 'Test3' RunsOn = 'macos-latest' - Path = 'test' } ) } Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest } - - name: Run-test - shell: pwsh - env: - result: ${{ steps.test.outputs.result }} - WISECAT: ${{ fromJson(steps.test.outputs.result).WISECAT }} - Zen: ${{ fromJson(steps.test.outputs.result).Zen }} - Zen2: ${{ fromJson(steps.test.outputs.result).Zen2 }} - Context: ${{ fromJson(steps.test.outputs.result).Context }} - GitConfig: ${{ fromJson(steps.test.outputs.result).GitConfig }} - ComplexArray: ${{ fromJson(steps.test.outputs.result).ComplexArray }} - ComplexArrayJson: ${{ fromJson(steps.test.outputs.result).ComplexArrayJson }} - run: | - $result = $env:result | ConvertFrom-Json - - LogGroup 'Result - Json' { - $env:result - } - - LogGroup 'Result - Object' { - $result - } - - LogGroup "WISECAT" { - Write-Host $env:WISECAT - } - - LogGroup "Zen" { - Write-Host $env:Zen - } - - LogGroup "Context" { - $env:Context | Format-List - } - - LogGroup "GitConfig" { - $env:GitConfig | Format-List - } - - LogGroup "Zen2" { - Write-Host $env:Zen2 - } - - LogGroup "ComplexArray" { - $env:ComplexArray | Format-List - } - - LogGroup "ComplexArrayJson" { - $env:ComplexArrayJson - } - - LogGroup "Other" { - Set-GitHubStepSummary -Summary $env:WISECAT - Write-GitHubNotice -Message $result.Zen -Title 'GitHub Zen' - Write-Host ($result.Zen2) - $result.Context | Format-List - $result.GitConfig | Format-List - } - MatrixTest: needs: ActionTestCommands strategy: - matrix: ${{ needs.ActionTestCommands.outputs.MatrixTest }} + matrix: + config: ${{ fromJson(needs.ActionTestCommands.outputs.MatrixTest) }} name: Matrix Test [${{ matrix.Name }}] runs-on: ${{ matrix.RunsOn }} steps: From d7ceb86fc95396e2681bf0fb228c98cc37869c9a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:45:12 +0100 Subject: [PATCH 28/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20Action?= =?UTF-8?q?-Test=20workflow=20to=20change=20MatrixTest=20environment=20var?= =?UTF-8?q?iable=20to=20Path=20and=20create=20directory=20for=20matrix=20t?= =?UTF-8?q?ests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index 4114785..17c3100 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -77,7 +77,8 @@ jobs: - name: Matrix Test shell: pwsh env: - MatrixTest: ${{ matrix.Cars }} + Path: ${{ matrix.Path }} run: | - $matrixTest = $env:MatrixTest | ConvertFrom-Json - $matrixTest | Format-List + New-Item -Path $env:Path -ItemType Directory -Force + Write-Host "Matrix Test: $env:Path" + From ab7b8a2ec270dc52cb3bba867581c1697634e5d4 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:45:41 +0100 Subject: [PATCH 29/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Simplify=20Matr?= =?UTF-8?q?ixTest=20strategy=20configuration=20in=20Action-Test=20workflow?= =?UTF-8?q?=20by=20removing=20redundant=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index 17c3100..daa1d06 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -69,8 +69,7 @@ jobs: MatrixTest: needs: ActionTestCommands strategy: - matrix: - config: ${{ fromJson(needs.ActionTestCommands.outputs.MatrixTest) }} + matrix: ${{ fromJson(needs.ActionTestCommands.outputs.MatrixTest) }} name: Matrix Test [${{ matrix.Name }}] runs-on: ${{ matrix.RunsOn }} steps: From 9204ce31ee49d5d02061a7c9075244c66358376d Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:47:20 +0100 Subject: [PATCH 30/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Remove=20redund?= =?UTF-8?q?ant=20'Path'=20assignment=20in=20MatrixTest=20configuration=20f?= =?UTF-8?q?or=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index daa1d06..c4e2a69 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -47,7 +47,6 @@ jobs: Script: | LogGroup 'MatrixTest' { $matrixTest = @{ - Path = 'test' include = @( @{ Name = 'Test' From 48dd0286217dc98aff3b665b7afd69ba06df0368 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:47:59 +0100 Subject: [PATCH 31/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20'Path'=20?= =?UTF-8?q?assignment=20to=20MatrixTest=20configuration=20for=20test=20dir?= =?UTF-8?q?ectories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index c4e2a69..344fa7f 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -47,6 +47,7 @@ jobs: Script: | LogGroup 'MatrixTest' { $matrixTest = @{ + Path = @('test', 'test2', 'test3') include = @( @{ Name = 'Test' From 21f53ca4f75b537169a88ee5c89a05a3f7554f2e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:50:42 +0100 Subject: [PATCH 32/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20Matrix?= =?UTF-8?q?Test=20configuration=20to=20use=20specific=20test=20directories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index 344fa7f..2751921 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -47,7 +47,7 @@ jobs: Script: | LogGroup 'MatrixTest' { $matrixTest = @{ - Path = @('test', 'test2', 'test3') + Path = @('tests/srcTestRepo', 'tests/srcWithManifestTestRepo') include = @( @{ Name = 'Test' From 6b4cb144a50e9d78f2391533fbea8a579665214a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:54:24 +0100 Subject: [PATCH 33/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Refactor=20Matr?= =?UTF-8?q?ixTest=20configuration=20to=20consolidate=20'RunsOn'=20assignme?= =?UTF-8?q?nts=20for=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index 2751921..b0439a0 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -48,21 +48,7 @@ jobs: LogGroup 'MatrixTest' { $matrixTest = @{ Path = @('tests/srcTestRepo', 'tests/srcWithManifestTestRepo') - include = @( - @{ - Name = 'Test' - RunsOn = 'ubuntu-latest' - }, - @{ - Name = 'Test2' - RunsOn = 'windows-latest' - }, - @{ - Name = 'Test3' - RunsOn = 'macos-latest' - } - ) - } + RunsOn = @('ubuntu-latest','windows-latest','macos-latest') Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest } From 3a572eb3f9881226323bf38a8cfc4ee8c5aac93f Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:56:24 +0100 Subject: [PATCH 34/48] Refactor MatrixTest output assignment to improve clarity and consistency in Action-Test workflow --- .github/workflows/Action-Test-Prerelease.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index b0439a0..de7e800 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -46,17 +46,18 @@ jobs: ShowOutput: true Script: | LogGroup 'MatrixTest' { - $matrixTest = @{ - Path = @('tests/srcTestRepo', 'tests/srcWithManifestTestRepo') - RunsOn = @('ubuntu-latest','windows-latest','macos-latest') - Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest + $matrixTest = @{ + Path = @('tests/srcTestRepo', 'tests/srcWithManifestTestRepo') + RunsOn = @('ubuntu-latest', 'windows-latest', 'macos-latest') + } + Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest } MatrixTest: needs: ActionTestCommands strategy: matrix: ${{ fromJson(needs.ActionTestCommands.outputs.MatrixTest) }} - name: Matrix Test [${{ matrix.Name }}] + name: Matrix Test [${{ matrix.RunsOn }}] runs-on: ${{ matrix.RunsOn }} steps: - name: Matrix Test From 0c42071f9b73bbeec73b520643ef0e3027a31b30 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 00:59:59 +0100 Subject: [PATCH 35/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Refactor=20Acti?= =?UTF-8?q?on-Test=20workflow=20to=20streamline=20matrix=20creation=20and?= =?UTF-8?q?=20improve=20clarity=20in=20job=20dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 61 +++-------------- .github/workflows/TestWorkflow.yml | 72 +++++++++++--------- 2 files changed, 48 insertions(+), 85 deletions(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index de7e800..07127c2 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -15,56 +15,13 @@ permissions: pull-requests: read jobs: - # ActionTest: - # uses: ./.github/workflows/TestWorkflow.yml - # secrets: inherit - # strategy: - # fail-fast: false - # matrix: - # os: [ubuntu-latest, macos-latest, windows-latest] - # with: - # runs-on: ${{ matrix.os }} - # Prerelease: true - ActionTestCommands: - name: Commands + Outputs - runs-on: ubuntu-latest - outputs: - MatrixTest: ${{ fromJson(steps.test.outputs.result).MatrixTest }} - steps: - # Need to check out as part of the test, as its a local action - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Action-Test - uses: ./ - id: test - with: - Debug: true - Verbose: true - Prerelease: true - ShowInit: true - ShowOutput: true - Script: | - LogGroup 'MatrixTest' { - $matrixTest = @{ - Path = @('tests/srcTestRepo', 'tests/srcWithManifestTestRepo') - RunsOn = @('ubuntu-latest', 'windows-latest', 'macos-latest') - } - Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest - } - - MatrixTest: - needs: ActionTestCommands + ActionTest: + uses: ./.github/workflows/TestWorkflow.yml + secrets: inherit strategy: - matrix: ${{ fromJson(needs.ActionTestCommands.outputs.MatrixTest) }} - name: Matrix Test [${{ matrix.RunsOn }}] - runs-on: ${{ matrix.RunsOn }} - steps: - - name: Matrix Test - shell: pwsh - env: - Path: ${{ matrix.Path }} - run: | - New-Item -Path $env:Path -ItemType Directory -Force - Write-Host "Matrix Test: $env:Path" - + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + with: + runs-on: ${{ matrix.os }} + Prerelease: true diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index bf93f61..a16d894 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -216,28 +216,6 @@ jobs: Get-Content $env:GITHUB_OUTPUT -Raw | Set-GitHubStepSummary } - LogGroup 'MatrixTest' { - $matrixTest = @{ - include = @( - [pscustomobject]@{ - Name = 'Test' - RunsOn = 'ubuntu-latest' - Path = 'test' - }, - [pscustomobject]@{ - Name = 'Test2' - RunsOn = 'windows-latest' - Path = 'test' - }, - [pscustomobject]@{ - Name = 'Test3' - RunsOn = 'macos-latest' - Path = 'test' - } - ) - } - Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest - } - name: Run-test shell: pwsh @@ -290,27 +268,55 @@ jobs: } LogGroup "Other" { - Set-GitHubStepSummary -Summary $env:WISECAT - Write-GitHubNotice -Message $result.Zen -Title 'GitHub Zen' - Write-Host ($result.Zen2) - $result.Context | Format-List - $result.GitConfig | Format-List + Set-GitHubStepSummary -Summary $env:WISECAT + Write-GitHubNotice -Message $result.Zen -Title 'GitHub Zen' + Write-Host ($result.Zen2) + $result.Context | Format-List + $result.GitConfig | Format-List } + MatrixCreator: + name: Matrix Creator + runs-on: ubuntu-latest + outputs: + MatrixTest: ${{ fromJson(steps.test.outputs.result).MatrixTest }} + steps: + # Need to check out as part of the test, as its a local action + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Action-Test + uses: ./ + id: test + with: + Debug: true + Verbose: true + Prerelease: true + ShowInit: true + ShowOutput: true + Script: | + LogGroup 'MatrixTest' { + $matrixTest = @{ + Path = @('tests/srcTestRepo', 'tests/srcWithManifestTestRepo') + RunsOn = @('ubuntu-latest', 'windows-latest', 'macos-latest') + } + Set-GitHubOutput -Name 'MatrixTest' -Value $matrixTest + } + MatrixTest: - needs: ActionTestCommands + needs: MatrixCreator strategy: - matrix: ${{ needs.ActionTestCommands.outputs.MatrixTest }} - name: Matrix Test [${{ matrix.Name }}] + matrix: ${{ fromJson(needs.MatrixCreator.outputs.MatrixTest) }} + name: Matrix Test [${{ matrix.RunsOn }}] runs-on: ${{ matrix.RunsOn }} steps: - name: Matrix Test shell: pwsh env: - MatrixTest: ${{ matrix.Cars }} + Path: ${{ matrix.Path }} run: | - $matrixTest = $env:MatrixTest | ConvertFrom-Json - $matrixTest | Format-List + New-Item -Path $env:Path -ItemType Directory -Force + Write-Host "Matrix Test: $env:Path" ActionTestWithoutToken: name: WithoutToken From ca433992b9798c8c97444800912cd06f987ccc40 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 01:04:16 +0100 Subject: [PATCH 36/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Enhance=20Matri?= =?UTF-8?q?x=20Test=20step=20to=20capture=20and=20display=20created=20dire?= =?UTF-8?q?ctory=20output=20for=20improved=20visibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index a16d894..6293310 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -312,11 +312,19 @@ jobs: steps: - name: Matrix Test shell: pwsh + id: test env: Path: ${{ matrix.Path }} run: | - New-Item -Path $env:Path -ItemType Directory -Force - Write-Host "Matrix Test: $env:Path" + $item = New-Item -Path $env:Path -ItemType Directory -Force + Set-GithubOutput -Name 'Item' -Value $item + + - name: Matrix Test [Show] + shell: pwsh + env: + Item: ${{ steps.test.outputs.item }} + run: | + $env:Item ActionTestWithoutToken: name: WithoutToken From 82809acc2457d58a0bfbc940c058c1025dede9f3 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 01:04:53 +0100 Subject: [PATCH 37/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20installat?= =?UTF-8?q?ion=20of=20GitHub=20PSResource=20in=20TestWorkflow=20for=20impr?= =?UTF-8?q?oved=20functionality?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 6293310..2ba7b82 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -316,6 +316,7 @@ jobs: env: Path: ${{ matrix.Path }} run: | + Install-PSResource -Name GitHub -TrustRepository $item = New-Item -Path $env:Path -ItemType Directory -Force Set-GithubOutput -Name 'Item' -Value $item From 38b2b22e1cf002a1df6ad8da38f43bb990f8ba5e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 01:07:07 +0100 Subject: [PATCH 38/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20Matrix?= =?UTF-8?q?=20Test=20to=20create=20a=20custom=20object=20for=20directory?= =?UTF-8?q?=20existence=20check,=20enhancing=20output=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 2ba7b82..8dd5d7d 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -317,7 +317,10 @@ jobs: Path: ${{ matrix.Path }} run: | Install-PSResource -Name GitHub -TrustRepository - $item = New-Item -Path $env:Path -ItemType Directory -Force + $item = [pscustomobject]@{ + Path = $env:Path + Exists = Test-Path -Path $env:Path + } Set-GithubOutput -Name 'Item' -Value $item - name: Matrix Test [Show] From 8b2e62b492e981e43d6d679291538fc3101ec081 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 01:27:50 +0100 Subject: [PATCH 39/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20logging?= =?UTF-8?q?=20for=20PSMODULE=5FGITHUB=5FSCRIPT=20in=20TestWorkflow=20to=20?= =?UTF-8?q?enhance=20debugging=20visibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 8dd5d7d..690cdcd 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -317,6 +317,7 @@ jobs: Path: ${{ matrix.Path }} run: | Install-PSResource -Name GitHub -TrustRepository + Write-Host "PSMODULE_GITHUB_SCRIPT: $env:PSMODULE_GITHUB_SCRIPT" $item = [pscustomobject]@{ Path = $env:Path Exists = Test-Path -Path $env:Path @@ -328,6 +329,7 @@ jobs: env: Item: ${{ steps.test.outputs.item }} run: | + Write-Host "PSMODULE_GITHUB_SCRIPT: $env:PSMODULE_GITHUB_SCRIPT" $env:Item ActionTestWithoutToken: From e5e01032c49616898e5608f5e7c9a5e1110f5364 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 01:31:14 +0100 Subject: [PATCH 40/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20verbose?= =?UTF-8?q?=20and=20debug=20output=20to=20Set-GithubOutput=20in=20TestWork?= =?UTF-8?q?flow=20for=20enhanced=20visibility=20during=20execution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 690cdcd..79623f6 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -322,7 +322,7 @@ jobs: Path = $env:Path Exists = Test-Path -Path $env:Path } - Set-GithubOutput -Name 'Item' -Value $item + Set-GithubOutput -Name 'Item' -Value $item -Verbose -Debug -Confirm:$false - name: Matrix Test [Show] shell: pwsh From 23ab417d94ee53687d20ad868dca2cf0342fcf60 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 01:38:43 +0100 Subject: [PATCH 41/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20TestWo?= =?UTF-8?q?rkflow=20to=20install=20GitHub=20PSResource=20with=20-Prereleas?= =?UTF-8?q?e=20option=20for=20enhanced=20functionality?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 79623f6..390295d 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -316,7 +316,7 @@ jobs: env: Path: ${{ matrix.Path }} run: | - Install-PSResource -Name GitHub -TrustRepository + Install-PSResource -Name GitHub -TrustRepository -Prerelease Write-Host "PSMODULE_GITHUB_SCRIPT: $env:PSMODULE_GITHUB_SCRIPT" $item = [pscustomobject]@{ Path = $env:Path From cb71a506be6fd7ce67fdc32c8bd64331a5d3b7c0 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 01:54:00 +0100 Subject: [PATCH 42/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Enhance=20TestW?= =?UTF-8?q?orkflow=20logging=20and=20validation=20for=20environment=20vari?= =?UTF-8?q?ables=20and=20JSON=20objects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 32 +++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 390295d..06c0cb5 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -248,11 +248,11 @@ jobs: } LogGroup "Context" { - $env:Context | Format-List + $env:Context } LogGroup "GitConfig" { - $env:GitConfig | Format-List + $env:GitConfig } LogGroup "Zen2" { @@ -260,11 +260,19 @@ jobs: } LogGroup "ComplexArray" { - $env:ComplexArray | Format-List + $env:ComplexArray + if (-not Test-Json -Json $env:ComplexArray) { + Write-Host "Item is not a JSON object" + exit 1 + } } LogGroup "ComplexArrayJson" { $env:ComplexArrayJson + if (-not Test-Json -Json $env:ComplexArrayJson) { + Write-Host "Item is not a JSON object" + exit 1 + } } LogGroup "Other" { @@ -272,7 +280,14 @@ jobs: Write-GitHubNotice -Message $result.Zen -Title 'GitHub Zen' Write-Host ($result.Zen2) $result.Context | Format-List + if ($result.GitConfig -isnot [System.Management.Automation.PSCustomObject]) { + throw "GitConfig is not a PSCustomObject" + } + $result.GitConfig | Format-List + if ($result.GitConfig -isnot [System.Management.Automation.PSCustomObject]) { + throw "GitConfig is a PSCustomObject" + } } MatrixCreator: @@ -317,20 +332,23 @@ jobs: Path: ${{ matrix.Path }} run: | Install-PSResource -Name GitHub -TrustRepository -Prerelease - Write-Host "PSMODULE_GITHUB_SCRIPT: $env:PSMODULE_GITHUB_SCRIPT" + if ($PSMODULE_GITHUB_SCRIPT) { + throw "Is not running in GitHub-Script aciton! Failing" + } $item = [pscustomobject]@{ Path = $env:Path Exists = Test-Path -Path $env:Path } - Set-GithubOutput -Name 'Item' -Value $item -Verbose -Debug -Confirm:$false + Set-GithubOutput -Name 'Item' -Value $item - name: Matrix Test [Show] shell: pwsh env: Item: ${{ steps.test.outputs.item }} run: | - Write-Host "PSMODULE_GITHUB_SCRIPT: $env:PSMODULE_GITHUB_SCRIPT" - $env:Item + if (-not Test-Json -Json $env:Item) { + throw "Item is not a JSON object" + } ActionTestWithoutToken: name: WithoutToken From 3fa9ff291d49e63517c303d18355538c6284c68d Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 01:58:24 +0100 Subject: [PATCH 43/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Refactor=20JSON?= =?UTF-8?q?=20validation=20checks=20in=20TestWorkflow=20for=20improved=20r?= =?UTF-8?q?eadability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 06c0cb5..4a8c0c3 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -261,7 +261,7 @@ jobs: LogGroup "ComplexArray" { $env:ComplexArray - if (-not Test-Json -Json $env:ComplexArray) { + if (-not (Test-Json -Json $env:ComplexArray)) { Write-Host "Item is not a JSON object" exit 1 } @@ -269,7 +269,7 @@ jobs: LogGroup "ComplexArrayJson" { $env:ComplexArrayJson - if (-not Test-Json -Json $env:ComplexArrayJson) { + if (-not (Test-Json -Json $env:ComplexArrayJson)) { Write-Host "Item is not a JSON object" exit 1 } @@ -346,7 +346,7 @@ jobs: env: Item: ${{ steps.test.outputs.item }} run: | - if (-not Test-Json -Json $env:Item) { + if (-not (Test-Json -Json $env:Item)) { throw "Item is not a JSON object" } From 1bb1917abc6378dc0557be0037ddb34fb5405632 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 02:01:41 +0100 Subject: [PATCH 44/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20type=20ch?= =?UTF-8?q?ecks=20for=20GitConfig=20and=20Context=20in=20TestWorkflow=20fo?= =?UTF-8?q?r=20improved=20error=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index 4a8c0c3..fd5000c 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -280,11 +280,13 @@ jobs: Write-GitHubNotice -Message $result.Zen -Title 'GitHub Zen' Write-Host ($result.Zen2) $result.Context | Format-List + $result.Context.GetType().Name if ($result.GitConfig -isnot [System.Management.Automation.PSCustomObject]) { throw "GitConfig is not a PSCustomObject" } $result.GitConfig | Format-List + $result.GitConfig.GetType().Name if ($result.GitConfig -isnot [System.Management.Automation.PSCustomObject]) { throw "GitConfig is a PSCustomObject" } From a4bc0c88d5e239ad385626d35ada1bee6cb64717 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 02:03:00 +0100 Subject: [PATCH 45/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Add=20JSON=20co?= =?UTF-8?q?nversion=20and=20validation=20for=20Item=20in=20TestWorkflow=20?= =?UTF-8?q?to=20ensure=20proper=20data=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index fd5000c..b477180 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -348,6 +348,9 @@ jobs: env: Item: ${{ steps.test.outputs.item }} run: | + $env:Item + $env:Item | ConvertFrom-Json + if (-not (Test-Json -Json $env:Item)) { throw "Item is not a JSON object" } From 69b1b721773b89fb1b48a130a9f7c2ee58d639c2 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 02:04:35 +0100 Subject: [PATCH 46/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20GitCon?= =?UTF-8?q?fig=20type=20check=20in=20TestWorkflow=20to=20ensure=20it=20is?= =?UTF-8?q?=20a=20string=20for=20improved=20validation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/TestWorkflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/TestWorkflow.yml b/.github/workflows/TestWorkflow.yml index b477180..37f20c3 100644 --- a/.github/workflows/TestWorkflow.yml +++ b/.github/workflows/TestWorkflow.yml @@ -281,13 +281,13 @@ jobs: Write-Host ($result.Zen2) $result.Context | Format-List $result.Context.GetType().Name - if ($result.GitConfig -isnot [System.Management.Automation.PSCustomObject]) { + if ($result.GitConfig -isnot [String]) { throw "GitConfig is not a PSCustomObject" } $result.GitConfig | Format-List $result.GitConfig.GetType().Name - if ($result.GitConfig -isnot [System.Management.Automation.PSCustomObject]) { + if ($result.GitConfig -isnot [String]) { throw "GitConfig is a PSCustomObject" } } From d8e43380547a42e7bf720ae6470f6647b34201a3 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 10:04:50 +0100 Subject: [PATCH 47/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Change=20Write-?= =?UTF-8?q?Output=20to=20Write-Verbose=20for=20improved=20logging=20in=20i?= =?UTF-8?q?nfo.ps1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/info.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/info.ps1 b/scripts/info.ps1 index 17632de..2ccdd73 100644 --- a/scripts/info.ps1 +++ b/scripts/info.ps1 @@ -28,9 +28,9 @@ process { $context = Get-GitHubContext $context | Format-List - Write-Output "Token? [$([string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" - Write-Output "AuthType? [$($context.AuthType)] - [$($context.AuthType -ne 'APP')]" - Write-Output "gh auth? [$($context.AuthType -ne 'APP' -and -not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" + Write-Verbose "Token? [$([string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" + Write-Verbose "AuthType? [$($context.AuthType)] - [$($context.AuthType -ne 'APP')]" + Write-Verbose "gh auth? [$($context.AuthType -ne 'APP' -and -not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token))]" if ($context.AuthType -ne 'APP' -and -not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) { Write-Output 'GitHub CLI status:' From d227f365959a3f599611df6e19f321ad09ae3265 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 25 Feb 2025 10:05:45 +0100 Subject: [PATCH 48/48] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Remove=20push?= =?UTF-8?q?=20trigger=20from=20Action-Test-Prerelease=20workflow=20for=20i?= =?UTF-8?q?mproved=20control=20over=20execution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test-Prerelease.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/Action-Test-Prerelease.yml b/.github/workflows/Action-Test-Prerelease.yml index 07127c2..eb1c725 100644 --- a/.github/workflows/Action-Test-Prerelease.yml +++ b/.github/workflows/Action-Test-Prerelease.yml @@ -4,7 +4,6 @@ run-name: "Action-Test - [${{ github.event.pull_request.title }} #${{ github.eve on: workflow_dispatch: - push: concurrency: group: ${{ github.workflow }}-${{ github.ref }}