From 822b1c254e120c59fbdfae9f1dba72f816cdd418 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Thu, 19 Dec 2024 17:58:34 +0000 Subject: [PATCH] feat: provide scope as parameter (#28) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## PR Checklist - [x] Addresses an existing open issue: fixes #27 - [x] That issue was marked as [`status: accepting prs`](https://github.com/johnnyreilly/azdo-npm-auth/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/johnnyreilly/azdo-npm-auth/blob/main/.github/CONTRIBUTING.md) were taken ## Overview See linked issue --- src/createPat.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/createPat.ts b/src/createPat.ts index b4c3c80..86f8f4a 100644 --- a/src/createPat.ts +++ b/src/createPat.ts @@ -11,10 +11,12 @@ export async function createPat({ logger = fallbackLogger, organisation, daysToExpiry, + scope = "vso.packaging", }: { logger?: Logger; organisation: string; daysToExpiry?: number; + scope?: string; }): Promise { // const credential = new InteractiveBrowserCredential({}); logger.info(`Creating Azure CLI Token`); @@ -39,7 +41,7 @@ export async function createPat({ const url = `https://vssps.dev.azure.com/${organisation}/_apis/tokens/pats?api-version=7.1-preview.1`; const data = { displayName: `made by azdo-npm-auth at: ${new Date().toISOString()}`, - scope: "vso.packaging", + scope, allOrgs: false, ...(validTo && { validTo: validTo.toISOString() }), };