From 32909db65d77279de0023860fc87d6c1589c404d Mon Sep 17 00:00:00 2001 From: Alexander Holstrup <117829001+aholstrup1@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:47:13 +0100 Subject: [PATCH] Update PR Create command to not use Invoke-Expression (#1369) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current Update AL-Go System files is failing on BCApps: https://github.com/microsoft/BCApps/actions/runs/12389564864 When invoking gh-cli it throws the error: `unknown arguments ["appFolders optional\n- Issue 1344 Experimental feature git" "submodules seems to be a breaking change\n- Issue 1305 Extra telemetry Property RepositoryOwner and RepositoryName¨\n- Add RunnerEnvironment to Telemetry\n- Output a notice, not a warning, when there are no available updates for AL-Go for GitHub\n\n### New Repository Settings\n\n- useGitSubmodules can be either \true or \recursive if you want to enable Git Submodules in your repository. If your Git submodules reside` Error most likely stems from unescaped characters in the release notes. Update PR Create command to not use Invoke-Expression --- Actions/AL-Go-Helper.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 424ee0b0b..2549f6b18 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -1409,15 +1409,14 @@ function CommitFromNewFolder { } invoke-git push -u $serverUrl $branch try { - $prCreateCmd = "invoke-gh pr create --fill --title ""$title"" --head ""$branch"" --repo ""$env:GITHUB_REPOSITORY"" --base ""$ENV:GITHUB_REF_NAME"" --body ""$body""" if ($settings.commitOptions.pullRequestLabels) { $labels = "$($settings.commitOptions.pullRequestLabels -join ",")" Write-Host "Adding labels: $labels" - $prCreateCmd += " --label ""$labels""" + invoke-gh pr create --fill --head $branch --repo $env:GITHUB_REPOSITORY --base $ENV:GITHUB_REF_NAME --body "$body" --label $labels + } else { + invoke-gh pr create --fill --head $branch --repo $env:GITHUB_REPOSITORY --base $ENV:GITHUB_REF_NAME --body "$body" } - Invoke-Expression $prCreateCmd - if ($settings.commitOptions.pullRequestAutoMerge) { invoke-gh pr merge --auto --squash --delete-branch }