resolveTopLevelGitHubApp resolves the top-level github-app for token minting fallback. Precedence: 1. Current workflow's top-level github-app (explicit override wins) 2. First top-level github-app found across imported shared workflows 3. Nil (no fallback configured)
(frontmatter map[string]any, importsResult *parser.ImportsResult)
| 34 | // 2. First top-level github-app found across imported shared workflows |
| 35 | // 3. Nil (no fallback configured) |
| 36 | func resolveTopLevelGitHubApp(frontmatter map[string]any, importsResult *parser.ImportsResult) *GitHubAppConfig { |
| 37 | if app := extractTopLevelGitHubApp(frontmatter); app != nil { |
| 38 | return app |
| 39 | } |
| 40 | if importsResult != nil && importsResult.MergedTopLevelGitHubApp != "" { |
| 41 | var appMap map[string]any |
| 42 | if err := json.Unmarshal([]byte(importsResult.MergedTopLevelGitHubApp), &appMap); err == nil { |
| 43 | app := parseAppConfig(appMap) |
| 44 | if app.AppID != "" && app.PrivateKey != "" { |
| 45 | workflowGitHubAppLog.Print("Using top-level github-app from imported shared workflow") |
| 46 | return app |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | return nil |
| 51 | } |
| 52 | |
| 53 | // topLevelFallbackNeeded reports whether the top-level github-app should be applied as a |
| 54 | // fallback for a given section. It returns true when the section has neither an explicit |
no test coverage detected