@@ -261,46 +261,6 @@ var apiClientForContext = func(ctx context.Context) (*api.Client, error) {
261261 return api .NewClient (opts ... ), nil
262262}
263263
264- var ensureScopes = func (ctx context.Context , client * api.Client , wantedScopes ... string ) (* api.Client , error ) {
265- hasScopes , appID , err := client .HasScopes (wantedScopes ... )
266- if err != nil {
267- return client , err
268- }
269-
270- if hasScopes {
271- return client , nil
272- }
273-
274- tokenFromEnv := len (os .Getenv ("GITHUB_TOKEN" )) > 0
275-
276- if config .IsGitHubApp (appID ) && ! tokenFromEnv && utils .IsTerminal (os .Stdin ) && utils .IsTerminal (os .Stderr ) {
277- cfg , err := ctx .Config ()
278- if err != nil {
279- return nil , err
280- }
281- _ , err = config .AuthFlowWithConfig (cfg , defaultHostname , "Notice: additional authorization required" )
282- if err != nil {
283- return nil , err
284- }
285-
286- reloadedClient , err := apiClientForContext (ctx )
287- if err != nil {
288- return client , err
289- }
290- return reloadedClient , nil
291- } else {
292- fmt .Fprintf (os .Stderr , "Warning: gh now requires %s OAuth scopes.\n " , wantedScopes )
293- fmt .Fprintf (os .Stderr , "Visit https://github.com/settings/tokens and edit your token to enable %s\n " , wantedScopes )
294- if tokenFromEnv {
295- fmt .Fprintln (os .Stderr , "or generate a new token for the GITHUB_TOKEN environment variable" )
296- } else {
297- fmt .Fprintln (os .Stderr , "or generate a new token and paste it via `gh config set -h github.com oauth_token MYTOKEN`" )
298- }
299- return client , errors .New ("Unable to reauthenticate" )
300- }
301-
302- }
303-
304264func apiVerboseLog () api.ClientOption {
305265 logTraffic := strings .Contains (os .Getenv ("DEBUG" ), "api" )
306266 colorize := utils .IsTerminal (os .Stderr )
0 commit comments