@@ -87,6 +87,7 @@ export interface UserProvidedArgs {
87
87
"locate-extension" ?: string [ ]
88
88
"show-versions" ?: boolean
89
89
category ?: string
90
+ "github-auth" ?: string
90
91
}
91
92
92
93
interface Option < T > {
@@ -205,6 +206,7 @@ const options: Options<Required<UserProvidedArgs>> = {
205
206
} ,
206
207
"uninstall-extension" : { type : "string[]" , description : "Uninstall a VS Code extension by id." } ,
207
208
"show-versions" : { type : "boolean" , description : "Show VS Code extension versions." } ,
209
+ "github-auth" : { type : "string" , description : "GitHub authentication token (can only be passed in via $GITHUB_AUTH_TOKEN or the config file)." } ,
208
210
"proxy-domain" : { type : "string[]" , description : "Domain used for proxying ports." } ,
209
211
"ignore-last-opened" : {
210
212
type : "boolean" ,
@@ -336,6 +338,10 @@ export const parse = (
336
338
throw new Error ( "--hashed-password can only be set in the config file or passed in via $HASHED_PASSWORD" )
337
339
}
338
340
341
+ if ( key === "github-auth" && ! opts ?. configFile ) {
342
+ throw new Error ( "--github-auth can only be set in the config file or passed in via $GITHUB_AUTH_TOKEN" )
343
+ }
344
+
339
345
const option = options [ key ]
340
346
if ( option . type === "boolean" ) {
341
347
; ( args [ key ] as boolean ) = true
@@ -409,7 +415,12 @@ export const parse = (
409
415
410
416
logger . debug ( ( ) => [
411
417
`parsed ${ opts ?. configFile ? "config" : "command line" } ` ,
412
- field ( "args" , { ...args , password : undefined } ) ,
418
+ field ( "args" , {
419
+ ...args ,
420
+ password : args . password ? "<redacted>" : undefined ,
421
+ "hashed-password" : args [ "hashed-password" ] ? "<redacted>" : undefined ,
422
+ "github-auth" : args [ "github-auth" ] ? "<redacted>" : undefined
423
+ } ) ,
413
424
] )
414
425
415
426
return args
@@ -530,9 +541,14 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config
530
541
usingEnvPassword = false
531
542
}
532
543
544
+ if ( process . env . GITHUB_AUTH_TOKEN ) {
545
+ args [ "github-auth" ] = process . env . GITHUB_AUTH_TOKEN
546
+ }
547
+
533
548
// Ensure they're not readable by child processes.
534
549
delete process . env . PASSWORD
535
550
delete process . env . HASHED_PASSWORD
551
+ delete process . env . GITHUB_AUTH_TOKEN
536
552
537
553
// Filter duplicate proxy domains and remove any leading `*.`.
538
554
const proxyDomains = new Set ( ( args [ "proxy-domain" ] || [ ] ) . map ( ( d ) => d . replace ( / ^ \* \. / , "" ) ) )
0 commit comments