Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions pkg/parser/frontmatter_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,28 @@ engine: claude
}
}

func TestUpdateWorkflowFrontmatterQuotesCronExpressions(t *testing.T) {
workflowPath := filepath.Join(testutil.TempDir(t, "test-*"), "scheduled-workflow.md")
initialContent := `---
on:
schedule:
- cron: "0 14 * * 1-5"
---
# Scheduled Workflow`
require.NoError(t, os.WriteFile(workflowPath, []byte(initialContent), 0644))

err := UpdateWorkflowFrontmatter(workflowPath, func(frontmatter map[string]any) error {
frontmatter["engine"] = "copilot"
return nil
}, false)
require.NoError(t, err)

updatedContent, err := os.ReadFile(workflowPath)
require.NoError(t, err)
assert.Contains(t, string(updatedContent), `cron: "0 14 * * 1-5"`)
assert.Contains(t, string(updatedContent), "engine: copilot")
}

func TestUpdateWorkflowFrontmatterErrorIncludesWorkflowPath(t *testing.T) {
tempDir := testutil.TempDir(t, "test-*")

Expand Down
1 change: 1 addition & 0 deletions pkg/parser/workflow_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func UpdateWorkflowFrontmatter(workflowPath string, updateFunc func(frontmatter
if err != nil {
return fmt.Errorf("could not marshal updated frontmatter for %q; ensure updated values are YAML-serializable, then retry: %w", workflowPath, err)
}
updatedFrontmatter = []byte(QuoteCronExpressions(string(updatedFrontmatter)))

// Reconstruct the file content
updatedContent, err := ReconstructWorkflowFile(string(updatedFrontmatter), result.Markdown)
Expand Down
Loading