6
6
"fmt"
7
7
"os"
8
8
"path/filepath"
9
+ "strings"
9
10
"sync"
10
11
"time"
11
12
@@ -340,9 +341,18 @@ func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env
340
341
}
341
342
342
343
for _ , credToolName := range callCtx .Tool .Credentials {
343
- cred , exists , err := store .Get (credToolName )
344
- if err != nil {
345
- return nil , fmt .Errorf ("failed to get credentials for tool %s: %w" , credToolName , err )
344
+ var (
345
+ cred * credentials.Credential
346
+ exists bool
347
+ err error
348
+ )
349
+
350
+ // Only try to look up the cred if the tool is on GitHub.
351
+ if isGitHubTool (credToolName ) {
352
+ cred , exists , err = store .Get (credToolName )
353
+ if err != nil {
354
+ return nil , fmt .Errorf ("failed to get credentials for tool %s: %w" , credToolName , err )
355
+ }
346
356
}
347
357
348
358
// If the credential doesn't already exist in the store, run the credential tool in order to get the value,
@@ -375,7 +385,7 @@ func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env
375
385
}
376
386
377
387
// Only store the credential if the tool is on GitHub.
378
- if callCtx .Program .ToolSet [credToolID ].Source .Repo != nil {
388
+ if isGitHubTool ( credToolName ) && callCtx .Program .ToolSet [credToolID ].Source .Repo != nil {
379
389
if err := store .Add (* cred ); err != nil {
380
390
return nil , fmt .Errorf ("failed to add credential for tool %s: %w" , credToolName , err )
381
391
}
@@ -391,3 +401,7 @@ func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env
391
401
392
402
return env , nil
393
403
}
404
+
405
+ func isGitHubTool (toolName string ) bool {
406
+ return strings .HasPrefix (toolName , "github.com" )
407
+ }
0 commit comments