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

Method extractLabelNames

pkg/workflow/role_checks.go:100–113  ·  view source on GitHub ↗

extractLabelNames extracts the 'labels' field from frontmatter. When set, the pre-activation job emits a job-level if: condition that skips the workflow (gray ⊘ rather than red ❌) when the triggering label does not match.

(frontmatter map[string]any)

Source from the content-addressed store, hash-verified

98// When set, the pre-activation job emits a job-level if: condition that skips the workflow
99// (gray ⊘ rather than red ❌) when the triggering label does not match.
100func (c *Compiler) extractLabelNames(frontmatter map[string]any) []string {
101 if onValue, exists := frontmatter["on"]; exists {
102 if onMap, ok := onValue.(map[string]any); ok {
103 if labelNamesValue, hasLabelNames := onMap["labels"]; hasLabelNames {
104 names := parseOptionalStringSliceField(labelNamesValue, "on.labels")
105 if len(names) > 0 {
106 roleLog.Printf("Extracted %d labels: %v", len(names), names)
107 return names
108 }
109 }
110 }
111 }
112 return nil
113}
114
115// extractRoles extracts the 'roles' field from frontmatter to determine permission requirements
116func (c *Compiler) extractRoles(frontmatter map[string]any) []string {

Callers 2

TestExtractLabelNamesFunction · 0.95

Calls 2

PrintfMethod · 0.45

Tested by 1

TestExtractLabelNamesFunction · 0.76