From e2ecae21f13d2061a08751f69db12bf14fac8b8e Mon Sep 17 00:00:00 2001 From: jankolarikMSFT <151537391+jankolarikMSFT@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:40:22 +0200 Subject: [PATCH] Updated check for new PAT format (#8985) --- coe-cli/src/commands/devops.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coe-cli/src/commands/devops.ts b/coe-cli/src/commands/devops.ts index 2389537c4..0508bed77 100644 --- a/coe-cli/src/commands/devops.ts +++ b/coe-cli/src/commands/devops.ts @@ -1206,6 +1206,7 @@ class DevOpsCommand { } async getGitCommitChanges(args: DevOpsBranchArguments, gitApi: gitm.IGitApi, projectRepo: GitRepository, pipelineRepo: GitRepository, sourceBranch: string, destinationBranch: string, defaultBranch: string, names: string[]): Promise { + const personalAccessTokenRegexp = /^.{76}AZDO.{4}$/; let pipelineProject = args.pipelineProject?.length > 0 ? args.pipelineProject : args.projectName let results: GitChange[] = [] @@ -1215,7 +1216,7 @@ class DevOpsCommand { 'Authorization': `Bearer ${accessToken}` } } - if (accessToken.length === 52) { + if (accessToken.length === 52 || personalAccessTokenRegexp.test(accessToken)) { config = { headers: { 'Authorization': `Basic ${Buffer.from(":" + accessToken).toString('base64')}`