MCPcopy Create free account
hub / github.com/github/gh-aw / validateWorkflowRunBranches

Method validateWorkflowRunBranches

pkg/workflow/agent_validation.go:255–274  ·  view source on GitHub ↗

validateWorkflowRunBranches validates workflow_run trigger requirements. It enforces required workflows and branch restrictions guidance.

(workflowData *WorkflowData, markdownPath string)

Source from the content-addressed store, hash-verified

253// validateWorkflowRunBranches validates workflow_run trigger requirements.
254// It enforces required workflows and branch restrictions guidance.
255func (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
276func parseWorkflowRunTrigger(onYAML string) (map[string]any, bool) {
277 var parsedData map[string]any

Callers 1

validatePermissionsMethod · 0.95

Calls 5

FormatInfoMessageFunction · 0.92
parseWorkflowRunTriggerFunction · 0.85
PrintMethod · 0.80

Tested by

no test coverage detected