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

Method parseMergePullRequestConfig

pkg/workflow/merge_pull_request.go:18–44  ·  view source on GitHub ↗

parseMergePullRequestConfig handles merge-pull-request configuration.

(outputMap map[string]any)

Source from the content-addressed store, hash-verified

16
17// parseMergePullRequestConfig handles merge-pull-request configuration.
18func (c *Compiler) parseMergePullRequestConfig(outputMap map[string]any) *MergePullRequestConfig {
19 configData, exists := outputMap["merge-pull-request"]
20 if !exists {
21 return nil
22 }
23
24 mergePullRequestLog.Print("Parsing merge-pull-request config")
25 cfg := &MergePullRequestConfig{}
26 if configMap, ok := configData.(map[string]any); ok {
27 cfg.RequiredLabels = ParseStringArrayFromConfig(configMap, "required-labels", mergePullRequestLog)
28 if len(cfg.RequiredLabels) == 0 {
29 // Deprecated: allowed-labels is migrated to required-labels by the codemod
30 cfg.RequiredLabels = ParseStringArrayFromConfig(configMap, "allowed-labels", mergePullRequestLog)
31 }
32 targetConfig, _ := ParseTargetConfig(configMap)
33 cfg.SafeOutputTargetConfig = targetConfig
34 cfg.AllowedBranches = ParseStringArrayFromConfig(configMap, "allowed-branches", mergePullRequestLog)
35 cfg.RequiredTitlePrefix = extractStringFromMap(configMap, "required-title-prefix", mergePullRequestLog)
36 c.parseBaseSafeOutputConfig(configMap, &cfg.BaseSafeOutputConfig, 1)
37 mergePullRequestLog.Printf("Parsed merge-pull-request config: requiredLabels=%v, allowedBranches=%v, requiredTitlePrefix=%q", cfg.RequiredLabels, cfg.AllowedBranches, cfg.RequiredTitlePrefix)
38 return cfg
39 }
40
41 // merge-pull-request: null enables defaults
42 cfg.Max = defaultIntStr(1)
43 return cfg
44}

Calls 7

ParseTargetConfigFunction · 0.85
extractStringFromMapFunction · 0.85
defaultIntStrFunction · 0.85
PrintMethod · 0.80
PrintfMethod · 0.45

Tested by 1