From 7b869804e5fa08970db638e5ff92e240cf96350b Mon Sep 17 00:00:00 2001 From: "Mikey Lombardi (He/Him)" Date: Thu, 31 Jul 2025 09:19:56 -0500 Subject: [PATCH 1/3] (GHA) Fix authorization workflow (#12252) Prior to this change, the authorization workflow used the PowerShell script parameter names and casing for the action parameter names. This worked for all previous parameters because PowerShell is case insensitive and the parameters were only one word. However, in #12181, we added the `authorized_accounts` parameter to the workflow. For GitHub Actions, we use `snake_case` for parameter names, where PowerShell best practice is to use `PascalCase`. PowerShell's case insensitivity meant that we were able to handle the prior parameters, which the workflow sends to the handler scripts as the `INPUT_` environment variables. When we added `authorized_accounts`, the handler scripts were looking for `INPUT_AuthorizedAccounts`, which doesn't exist. This change updates the `Name` key for every defined parameter in the `verification/authorization/v1` workflow to match the actual workflow parameter name and casing. --- .../verification/authorization/v1/Parameters.psd1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/verification/authorization/v1/Parameters.psd1 b/.github/actions/verification/authorization/v1/Parameters.psd1 index 306e47874109..4205303dd399 100644 --- a/.github/actions/verification/authorization/v1/Parameters.psd1 +++ b/.github/actions/verification/authorization/v1/Parameters.psd1 @@ -1,7 +1,7 @@ @{ Parameters = @( @{ - Name = 'Repository' + Name = 'repository' Type = 'string' IfNullOrEmpty = { param($ErrorTarget) @@ -30,7 +30,7 @@ } } @{ - Name = 'AuthorizedAccounts' + Name = 'authorized_accounts' Type = 'String[]' IfNullOrEmpty = { param($ErrorTarget) @@ -50,7 +50,7 @@ } @{ - Name = 'Permissions' + Name = 'permissions' Type = 'String[]' IfNullOrEmpty = { param($ErrorTarget) @@ -118,7 +118,7 @@ } @{ - Name = 'Target' + Name = 'target' Type = 'String[]' IfNullOrEmpty = { param($ErrorTarget) @@ -191,7 +191,7 @@ } @{ - Name = 'User' + Name = 'user' Type = 'String' IfNullOrEmpty = { param($ErrorTarget) @@ -222,4 +222,4 @@ } } ) -} \ No newline at end of file +} From 6065db0133bdaa10bd8048509ee4c5bdde21450c Mon Sep 17 00:00:00 2001 From: "Mikey Lombardi (He/Him)" Date: Thu, 31 Jul 2025 10:03:40 -0500 Subject: [PATCH 2/3] (GHA) Update casing and fix authorization (#12253) Prior to this change, the authorization parameter handling didn't correctly handle an empty string for the `authorized_accounts` parameter. The casing for all other workflows used incorrect casing for workflow parameters, like `Message_Body` instead of `message_body`. This change: - Corrects the casing of all parameter handler entries. - Ensures that the parameter handler for `authorized_accounts` only passes the parameter to the action script when the input value is a non-empty string. --- .../commenting/expectations/v1/Parameters.psd1 | 6 +++--- .../reporting/stale-content/v1/Parameters.psd1 | 14 +++++++------- .../reporting/versioned-content/v1/Parameters.psd1 | 8 ++++---- .../verification/authorization/v1/Parameters.psd1 | 5 ++++- .../verification/checklist/v1/Parameters.psd1 | 4 ++-- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/actions/commenting/expectations/v1/Parameters.psd1 b/.github/actions/commenting/expectations/v1/Parameters.psd1 index c9767d9daf06..1e808a3c84a2 100644 --- a/.github/actions/commenting/expectations/v1/Parameters.psd1 +++ b/.github/actions/commenting/expectations/v1/Parameters.psd1 @@ -1,7 +1,7 @@ @{ Parameters = @( @{ - Name = 'Repository' + Name = 'repository' Type = 'string' IfNullOrEmpty = { param($ErrorTarget) @@ -31,7 +31,7 @@ } @{ - Name = 'Message_Body' + Name = 'message_body' Type = 'String' IfNullOrEmpty = { param($ErrorTarget) @@ -75,7 +75,7 @@ } @{ - Name = 'Message_Path' + Name = 'message_path' Type = 'String' IfNullOrEmpty = { param($ErrorTarget) diff --git a/.github/actions/reporting/stale-content/v1/Parameters.psd1 b/.github/actions/reporting/stale-content/v1/Parameters.psd1 index 56a419e1b539..de2302d0706c 100644 --- a/.github/actions/reporting/stale-content/v1/Parameters.psd1 +++ b/.github/actions/reporting/stale-content/v1/Parameters.psd1 @@ -1,7 +1,7 @@ @{ Parameters = @( @{ - Name = 'Relative_Folder_Path' + Name = 'relative_folder_path' Type = 'String[]' IfNullOrEmpty = { param($ErrorTarget) @@ -33,7 +33,7 @@ } @{ - Name = 'Exclude_Folder_Segment' + Name = 'exclude_folder_segment' Type = 'String[]' IfNullOrEmpty = { param($ErrorTarget) @@ -56,7 +56,7 @@ } @{ - Name = 'Days_Until_Stale' + Name = 'days_until_stale' Type = 'Int' IfNullOrEmpty = { param($ErrorTarget) @@ -91,7 +91,7 @@ } @{ - Name = 'Stale_Since_Date' + Name = 'stale_since_date' Type = 'DateTime' IfNullOrEmpty = { param($ErrorTarget) @@ -125,7 +125,7 @@ } @{ - Name = 'Upload_Artifact' + Name = 'upload_artifact' Type = 'Bool' IfNullOrEmpty = { param($ErrorTarget) @@ -166,7 +166,7 @@ } @{ - Name = 'Export_As_Csv' + Name = 'export_as_csv' Type = 'Bool' IfNullOrEmpty = { param($ErrorTarget) @@ -206,7 +206,7 @@ } @{ - Name = 'Export_Path' + Name = 'export_path' Type = 'string' IfNullOrEmpty = { param($ErrorTarget) diff --git a/.github/actions/reporting/versioned-content/v1/Parameters.psd1 b/.github/actions/reporting/versioned-content/v1/Parameters.psd1 index c27427eb3720..e2789ccd31a7 100644 --- a/.github/actions/reporting/versioned-content/v1/Parameters.psd1 +++ b/.github/actions/reporting/versioned-content/v1/Parameters.psd1 @@ -1,7 +1,7 @@ @{ Parameters = @( @{ - Name = 'Repository' + Name = 'repository' Type = 'String' IfNullOrEmpty = { param($ErrorTarget) @@ -31,7 +31,7 @@ } @{ - Name = 'Number' + Name = 'number' Type = 'Int' IfNullOrEmpty = { param($ErrorTarget) @@ -61,7 +61,7 @@ } @{ - Name = 'Include_Path_Pattern' + Name = 'include_path_pattern' Type = 'String[]' IfNullOrEmpty = { # It's okay if this parameter is not specified. @@ -84,7 +84,7 @@ } } @{ - Name = 'Exclude_Path_Pattern' + Name = 'exclude_path_pattern' Type = 'String[]' IfNullOrEmpty = { # It's okay if this parameter is not specified. diff --git a/.github/actions/verification/authorization/v1/Parameters.psd1 b/.github/actions/verification/authorization/v1/Parameters.psd1 index 4205303dd399..e20a091b9982 100644 --- a/.github/actions/verification/authorization/v1/Parameters.psd1 +++ b/.github/actions/verification/authorization/v1/Parameters.psd1 @@ -40,7 +40,10 @@ Process = { param($Parameters, $Value, $ErrorTarget) - [string[]]$SpecifiedAccounts = $Value -split ',' + [string[]]$SpecifiedAccounts = $Value -split ',' | Where-Object { + -not [string]::IsNullOrEmpty($_) + } + if ($SpecifiedAccounts.Count -gt 0) { $Parameters.AuthorizedAccounts = $SpecifiedAccounts Write-HostParameter -Name AuthorizedAccounts -Value $Parameters.AuthorizedAccounts diff --git a/.github/actions/verification/checklist/v1/Parameters.psd1 b/.github/actions/verification/checklist/v1/Parameters.psd1 index 237bf4803b0f..8e567b2bf266 100644 --- a/.github/actions/verification/checklist/v1/Parameters.psd1 +++ b/.github/actions/verification/checklist/v1/Parameters.psd1 @@ -1,7 +1,7 @@ @{ Parameters = @( @{ - Name = 'Body' + Name = 'body' Type = 'string' IfNullOrEmpty = { param($ErrorTarget) @@ -30,7 +30,7 @@ } @{ - Name = 'Reference_Url' + Name = 'reference_url' Type = 'string' IfNullOrEmpty = { param($ErrorTarget) From 4552e660006f4b15b2206b828ce7f730df2b8b28 Mon Sep 17 00:00:00 2001 From: "Mikey Lombardi (He/Him)" Date: Thu, 31 Jul 2025 10:14:42 -0500 Subject: [PATCH 3/3] (GHA) Fix `authorized_accounts` parameter handler (#12254) Prior to this change, the `verification/authorization/v1` workflow definition of the `authorized_accounts` parameter handler defined an empty scriptblock for the `IfNullOrEmpty` key to indicate that null/empty values are acceptable for this optional parameter. Instead, it shouldn't define the `IfNullOrEmpty` key-value pair at all. The `Get-ActionScriptParameter` helper function ignores null or empty values when the `IfNullOrEmpty` key isn't defined. This change removes the `IfNullOrEmpty` key-value pair from the `authorized_accounts` parameter handler definition. --- .../actions/verification/authorization/v1/Parameters.psd1 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/actions/verification/authorization/v1/Parameters.psd1 b/.github/actions/verification/authorization/v1/Parameters.psd1 index e20a091b9982..d849a1a8b74a 100644 --- a/.github/actions/verification/authorization/v1/Parameters.psd1 +++ b/.github/actions/verification/authorization/v1/Parameters.psd1 @@ -32,11 +32,6 @@ @{ Name = 'authorized_accounts' Type = 'String[]' - IfNullOrEmpty = { - param($ErrorTarget) - - # This parameter is optional, so don't error. - } Process = { param($Parameters, $Value, $ErrorTarget)