-
Notifications
You must be signed in to change notification settings - Fork 295
Fix dispatch-workflow validation: accept .md-only targets in same compile batch #20057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,14 +132,17 @@ func populateDispatchWorkflowFiles(data *WorkflowData, markdownPath string) { | |
| continue | ||
| } | ||
|
|
||
| // Determine which file to use - priority: .lock.yml > .yml | ||
| // Determine which file to use - priority: .lock.yml > .yml > .md (batch target) | ||
| var extension string | ||
| if fileResult.lockExists { | ||
| extension = ".lock.yml" | ||
| } else if fileResult.ymlExists { | ||
| extension = ".yml" | ||
| } else if fileResult.mdExists { | ||
| // .md-only: the workflow is a same-batch compilation target that will produce a .lock.yml | ||
| extension = ".lock.yml" | ||
| } else { | ||
| safeOutputsConfigLog.Printf("Warning: workflow file not found for %s (only .md exists, needs compilation)", workflowName) | ||
| safeOutputsConfigLog.Printf("Warning: no workflow file found for %s (checked .lock.yml, .yml, .md)", workflowName) | ||
| continue | ||
| } | ||
|
|
||
|
|
@@ -1314,17 +1317,23 @@ func generateFilteredToolsJSON(data *WorkflowData, markdownPath string) (string, | |
| continue | ||
| } | ||
|
|
||
| // Determine which file to use - priority: .lock.yml > .yml | ||
| // Determine which file to use - priority: .lock.yml > .yml > .md (batch target) | ||
| var workflowPath string | ||
| var extension string | ||
| var useMD bool | ||
| if fileResult.lockExists { | ||
| workflowPath = fileResult.lockPath | ||
| extension = ".lock.yml" | ||
| } else if fileResult.ymlExists { | ||
| workflowPath = fileResult.ymlPath | ||
| extension = ".yml" | ||
| } else if fileResult.mdExists { | ||
| // .md-only: the workflow is a same-batch compilation target that will produce a .lock.yml | ||
| workflowPath = fileResult.mdPath | ||
| extension = ".lock.yml" | ||
| useMD = true | ||
|
Comment on lines
+1330
to
+1334
|
||
| } else { | ||
| safeOutputsConfigLog.Printf("Warning: workflow file not found for %s (only .md exists, needs compilation)", workflowName) | ||
| safeOutputsConfigLog.Printf("Warning: no workflow file found for %s (checked .lock.yml, .yml, .md)", workflowName) | ||
| // Continue with empty inputs | ||
| tool := generateDispatchWorkflowTool(workflowName, make(map[string]any)) | ||
| filteredTools = append(filteredTools, tool) | ||
|
|
@@ -1335,9 +1344,15 @@ func generateFilteredToolsJSON(data *WorkflowData, markdownPath string) (string, | |
| data.SafeOutputs.DispatchWorkflow.WorkflowFiles[workflowName] = extension | ||
|
|
||
| // Extract workflow_dispatch inputs | ||
| workflowInputs, err := extractWorkflowDispatchInputs(workflowPath) | ||
| if err != nil { | ||
| safeOutputsConfigLog.Printf("Warning: failed to extract inputs for workflow %s from %s: %v", workflowName, workflowPath, err) | ||
| var workflowInputs map[string]any | ||
| var inputsErr error | ||
| if useMD { | ||
| workflowInputs, inputsErr = extractMDWorkflowDispatchInputs(workflowPath) | ||
| } else { | ||
| workflowInputs, inputsErr = extractWorkflowDispatchInputs(workflowPath) | ||
| } | ||
| if inputsErr != nil { | ||
| safeOutputsConfigLog.Printf("Warning: failed to extract inputs for workflow %s from %s: %v", workflowName, workflowPath, inputsErr) | ||
| // Continue with empty inputs | ||
| workflowInputs = make(map[string]any) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When mdHasWorkflowDispatch() returns an error, it can be due to frontmatter parsing (not just file I/O). Wrapping it as "failed to read workflow source" is misleading and makes debugging harder; consider wording like "failed to read or parse workflow source frontmatter" (or splitting read vs parse errors) so the reported failure matches the underlying cause.
This issue also appears on line 321 of the same file.