@@ -826,11 +826,12 @@ func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env
826
826
exists bool
827
827
)
828
828
829
- // Only try to look up the cred if the tool is on GitHub or has an alias
830
- if isGitHubTool (toolName ) {
831
- cred , exists , err = store .Get (credToolName )
829
+ // Only try to look up the cred if the tool is on GitHub or has an alias.
830
+ // If it is a GitHub tool and has an alias, the alias overrides the tool name, so we use it as the credential name.
831
+ if isGitHubTool (toolName ) && credentialAlias == "" {
832
+ cred , exists , err = store .Get (toolName )
832
833
if err != nil {
833
- return nil , fmt .Errorf ("failed to get credentials for tool %s: %w" , credToolName , err )
834
+ return nil , fmt .Errorf ("failed to get credentials for tool %s: %w" , toolName , err )
834
835
}
835
836
} else if credentialAlias != "" {
836
837
cred , exists , err = store .Get (credentialAlias )
@@ -881,7 +882,7 @@ func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env
881
882
if credentialAlias != "" {
882
883
cred .ToolName = credentialAlias
883
884
} else {
884
- cred .ToolName = credToolName
885
+ cred .ToolName = toolName
885
886
}
886
887
887
888
isEmpty := true
0 commit comments