@@ -141,10 +141,11 @@ var apiClientForContext = func(ctx context.Context) (*api.Client, error) {
141141 }
142142
143143 getAuthValue := func () string {
144+ fmt .Println ("GITTIN MY AUTH" , token )
144145 return fmt .Sprintf ("token %s" , token )
145146 }
146147
147- checkScopesFunc := func (appID string ) error {
148+ checkScopesFunc := func (wantedScope , appID string ) error {
148149 if config .IsGitHubApp (appID ) && utils .IsTerminal (os .Stdin ) && utils .IsTerminal (os .Stderr ) {
149150 newToken , loginHandle , err := config .AuthFlow ("Notice: additional authorization required" )
150151 if err != nil {
@@ -165,8 +166,7 @@ var apiClientForContext = func(ctx context.Context) (*api.Client, error) {
165166 token = newToken
166167 config .AuthFlowComplete ()
167168 } else {
168- // TODO for gist
169- fmt .Fprintln (os .Stderr , "Warning: gh now requires the `read:org` OAuth scope." )
169+ fmt .Fprintln (os .Stderr , fmt .Sprintf ("Warning: gh now requires the `%s` OAuth scope." , wantedScope ))
170170 fmt .Fprintln (os .Stderr , "Visit https://github.com/settings/tokens and edit your token to enable `read:org`" )
171171 fmt .Fprintln (os .Stderr , "or generate a new token and paste it via `gh config set -h github.com oauth_token MYTOKEN`" )
172172 }
@@ -175,6 +175,7 @@ var apiClientForContext = func(ctx context.Context) (*api.Client, error) {
175175
176176 opts = append (opts ,
177177 api .CheckScopes ("read:org" , checkScopesFunc ),
178+ api .CheckScopes ("gist" , checkScopesFunc ),
178179 api .AddHeaderFunc ("Authorization" , getAuthValue ),
179180 api .AddHeader ("User-Agent" , fmt .Sprintf ("GitHub CLI %s" , Version )),
180181 // antiope-preview: Checks
0 commit comments