From 7ec79ac5ce9d358a7ffbbe7f663e47886086b784 Mon Sep 17 00:00:00 2001 From: Rainer Halanek <61878316+rahalan@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:58:55 +0200 Subject: [PATCH] fix: rewrite misspelled URL to PR, for PR labeling automation (#3018) On PR created trigger, GH provides the URL to the PR through the 'github.event.pull_request.url' variable. Unfortunately, there is a spelling issue in it: it has an "s" too much in it (pulls instead of pull), see 'https://github.com/Azure/bicep-registry-modules/pulls/3016'. Because of that, the PR labeling logic fail, a it can't find the PR --- avm/utilities/pipelines/platform/Set-AvmGitHubPrLabels.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/avm/utilities/pipelines/platform/Set-AvmGitHubPrLabels.ps1 b/avm/utilities/pipelines/platform/Set-AvmGitHubPrLabels.ps1 index 06c5f87814..c0ed737877 100644 --- a/avm/utilities/pipelines/platform/Set-AvmGitHubPrLabels.ps1 +++ b/avm/utilities/pipelines/platform/Set-AvmGitHubPrLabels.ps1 @@ -37,8 +37,9 @@ function Set-AvmGitHubPrLabels { . (Join-Path $RepoRoot 'avm' 'utilities' 'pipelines' 'platform' 'helper' 'Get-GithubTeamMembersLogin.ps1') . (Join-Path $RepoRoot 'avm' 'utilities' 'pipelines' 'platform' 'helper' 'Get-AvmCsvData.ps1') - $pr = gh pr view $PrUrl.Replace('api.', '').Replace('repos/', '') --json 'author,title,url,body,comments' --repo $Repo | ConvertFrom-Json -Depth 100 - $allTeamNames = [array](Get-GithubPrRequestedReviewerTeamNames -PrUrl $PrUrl.Replace('api.', '').Replace('repos/', '')) + $sanitizedPrUrl = $PrUrl.Replace('api.', '').Replace('repos/', '').Replace('pulls/', 'pull/') + $pr = gh pr view $sanitizedPrUrl --json 'author,title,url,body,comments' --repo $Repo | ConvertFrom-Json -Depth 100 + $allTeamNames = [array](Get-GithubPrRequestedReviewerTeamNames -PrUrl $sanitizedPrUrl) $teamNames = [array]($allTeamNames | Where-Object { $_ -ne 'bicep-admins' -and $_ -ne 'avm-core-team-technical-bicep' -and $_ -ne 'avm-module-reviewers-bicep' }) # core team is already assigned, no or more than one module reviewer team is assigned