validateWorkflowRunBranches validates workflow_run trigger requirements. It enforces required workflows and branch restrictions guidance.
(workflowData *WorkflowData, markdownPath string)
| 253 | // validateWorkflowRunBranches validates workflow_run trigger requirements. |
| 254 | // It enforces required workflows and branch restrictions guidance. |
| 255 | func (c *Compiler) validateWorkflowRunBranches(workflowData *WorkflowData, markdownPath string) error { |
| 256 | if !strings.Contains(workflowData.On, "workflow_run") { |
| 257 | return nil |
| 258 | } |
| 259 | agentValidationLog.Print("Validating workflow_run trigger requirements") |
| 260 | workflowRunMap, ok := parseWorkflowRunTrigger(workflowData.On) |
| 261 | if !ok { |
| 262 | return nil |
| 263 | } |
| 264 | if err := validateWorkflowRunHasWorkflows(workflowRunMap, markdownPath); err != nil { |
| 265 | return err |
| 266 | } |
| 267 | if _, hasBranches := workflowRunMap["branches"]; hasBranches { |
| 268 | if c.verbose { |
| 269 | fmt.Fprintln(os.Stderr, console.FormatInfoMessage("✓ workflow_run trigger has branch restrictions")) |
| 270 | } |
| 271 | return nil |
| 272 | } |
| 273 | return c.emitWorkflowRunMissingBranches(markdownPath) |
| 274 | } |
| 275 | |
| 276 | func parseWorkflowRunTrigger(onYAML string) (map[string]any, bool) { |
| 277 | var parsedData map[string]any |
no test coverage detected