Skip to content

Commit 7b2f1f4

Browse files
fix: don't write local overrides to real workflow (#1637)
This was missed because it only happens outside of local development (e.g. after releasing the CLI)
1 parent 2d493a7 commit 7b2f1f4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

internal/model/command.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,15 @@ func runWithVersionFromWorkflowFile(cmd *cobra.Command) error {
289289

290290
artifactArch := ctx.Value(updates.ArtifactArchContextKey).(string)
291291

292-
// Try to migrate existing workflows, but only if they aren't on a pinned version
293-
if wf.SpeakeasyVersion.String() == "latest" {
292+
localWfExists := false
293+
if _, err := os.Stat(strings.TrimSuffix(wfPath, "workflow.yaml") + "workflow.local.yaml"); err == nil {
294+
localWfExists = true
295+
}
296+
297+
// Try to migrate existing workflows, but only if they aren't on a pinned version and a local workflow doesn't exist.
298+
// If a local workflow exists, calling updateWorkflowFile will cause local overrides to be persisted to the real workflow.yaml file.
299+
// There's probably a more robust solution here, perhaps applying the local override at a different point in the process, but this is good enough for now.
300+
if wf.SpeakeasyVersion.String() == "latest" && !localWfExists {
294301
run.Migrate(ctx, wf)
295302
_ = updateWorkflowFile(wf, wfPath)
296303
}

0 commit comments

Comments
 (0)