Skip to content

Commit 0f5bdf2

Browse files
authored
fix: improve confusing update messaging (#1682)
<img width="1790" height="342" alt="image (1)" src="https://github.com/user-attachments/assets/1ae33b52-aadd-4975-8573-a2cbcd9c24ab" /> The CLI confusingly displays two conflicting messages - this is because in the logic for displaying the message "Running with latest Speakeasy version" which is based on looking at the workflow.yaml `speakeasyVersion: latest` value, we do not actually check that we are on latest before rendering it (you can see from the subsequent screenshot that we do eventually autoupgrade)
1 parent 5ad3dd9 commit 0f5bdf2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

cmd/root.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ func checkForUpdate(ctx context.Context, currentVersion, artifactArch string, cm
161161
return
162162
}
163163

164+
wf, _, _ := utils.GetWorkflow()
165+
166+
// If we are running the run command and a workflow file is present and specifies that the speakeasyVersion is "latest", don't display update notifications as it will be automatically updated when the command is run.
167+
if cmd.Name() == "run" && wf != nil && wf.SpeakeasyVersion.String() == "latest" {
168+
return
169+
}
170+
164171
newerVersion, err := updates.GetNewerVersion(ctx, artifactArch, currentVersion)
165172
if err != nil {
166173
return // Don't display error to user

internal/model/command.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,11 @@ func runWithVersionFromWorkflowFile(cmd *cobra.Command) error {
312312
}
313313
desiredVersion = latest.String()
314314

315-
logger.PrintfStyled(styles.DimmedItalic, "Running with latest Speakeasy version\n")
315+
// Check if we're actually running the latest version
316+
currentVersion := events.GetSpeakeasyVersionFromContext(ctx)
317+
if newerVersion, err := updates.GetNewerVersion(ctx, artifactArch, currentVersion); err == nil && newerVersion == nil {
318+
logger.PrintfStyled(styles.DimmedItalic, "Running with latest Speakeasy version\n")
319+
}
316320
} else if desiredVersion == "pinned" {
317321
return ErrPinned
318322
} else {

0 commit comments

Comments
 (0)