@@ -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,10 @@ 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" : {
210
+ type : "string" ,
211
+ description : "GitHub authentication token (can only be passed in via $GITHUB_TOKEN or the config file)." ,
212
+ } ,
208
213
"proxy-domain" : { type : "string[]" , description : "Domain used for proxying ports." } ,
209
214
"ignore-last-opened" : {
210
215
type : "boolean" ,
@@ -336,6 +341,10 @@ export const parse = (
336
341
throw new Error ( "--hashed-password can only be set in the config file or passed in via $HASHED_PASSWORD" )
337
342
}
338
343
344
+ if ( key === "github-auth" && ! opts ?. configFile ) {
345
+ throw new Error ( "--github-auth can only be set in the config file or passed in via $GITHUB_TOKEN" )
346
+ }
347
+
339
348
const option = options [ key ]
340
349
if ( option . type === "boolean" ) {
341
350
; ( args [ key ] as boolean ) = true
@@ -409,7 +418,12 @@ export const parse = (
409
418
410
419
logger . debug ( ( ) => [
411
420
`parsed ${ opts ?. configFile ? "config" : "command line" } ` ,
412
- field ( "args" , { ...args , password : undefined } ) ,
421
+ field ( "args" , {
422
+ ...args ,
423
+ password : args . password ? "<redacted>" : undefined ,
424
+ "hashed-password" : args [ "hashed-password" ] ? "<redacted>" : undefined ,
425
+ "github-auth" : args [ "github-auth" ] ? "<redacted>" : undefined ,
426
+ } ) ,
413
427
] )
414
428
415
429
return args
@@ -530,9 +544,14 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config
530
544
usingEnvPassword = false
531
545
}
532
546
547
+ if ( process . env . GITHUB_TOKEN ) {
548
+ args [ "github-auth" ] = process . env . GITHUB_TOKEN
549
+ }
550
+
533
551
// Ensure they're not readable by child processes.
534
552
delete process . env . PASSWORD
535
553
delete process . env . HASHED_PASSWORD
554
+ delete process . env . GITHUB_TOKEN
536
555
537
556
// Filter duplicate proxy domains and remove any leading `*.`.
538
557
const proxyDomains = new Set ( ( args [ "proxy-domain" ] || [ ] ) . map ( ( d ) => d . replace ( / ^ \* \. / , "" ) ) )
0 commit comments