Skip to content

Commit 04e1e48

Browse files
committed
tweaks
Signed-off-by: Grant Linville <[email protected]>
1 parent eecb986 commit 04e1e48

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

docs/docs/03-tools/04-credentials.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ credentials: credential-tool-1.gpt, credential-tool-2.gpt
5151

5252
## Credential Tool Arguments
5353

54-
Your credential tool may define arguments. Here is an example:
54+
A credential tool may define arguments. Here is an example:
5555

5656
```yaml
5757
name: my-credential-tool
@@ -104,7 +104,7 @@ credentials: my-credential-tool.gpt as myAlias
104104
(tool stuff here)
105105
```
106106

107-
This will store the resulting credential with the name `myAlias`, rather than using the name of the tool (if it comes from GitHub).
107+
This will store the resulting credential with the name `myAlias`.
108108
This is useful when you want to reference the same credential tool in scripts that need to handle different credentials,
109109
or when you want to store credentials that were provided by a tool that is not on GitHub.
110110

pkg/runner/runner.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -826,11 +826,12 @@ func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env
826826
exists bool
827827
)
828828

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)
832833
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)
834835
}
835836
} else if credentialAlias != "" {
836837
cred, exists, err = store.Get(credentialAlias)
@@ -881,7 +882,7 @@ func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env
881882
if credentialAlias != "" {
882883
cred.ToolName = credentialAlias
883884
} else {
884-
cred.ToolName = credToolName
885+
cred.ToolName = toolName
885886
}
886887

887888
isEmpty := true

0 commit comments

Comments
 (0)