@@ -12,50 +12,8 @@ import (
1212var frontmatterLog = logger .New ("workflow:frontmatter_extraction" )
1313
1414// Note: extractStringValue, parseIntValue, and filterMapKeys have been moved to frontmatter_helpers.go
15-
16- // addCustomSafeOutputEnvVars adds custom environment variables to safe output job steps
17- func (c * Compiler ) addCustomSafeOutputEnvVars (steps * []string , data * WorkflowData ) {
18- if data .SafeOutputs != nil && len (data .SafeOutputs .Env ) > 0 {
19- for key , value := range data .SafeOutputs .Env {
20- * steps = append (* steps , fmt .Sprintf (" %s: %s\n " , key , value ))
21- }
22- }
23- }
24-
25- // addSafeOutputGitHubToken adds github-token to the with section of github-script actions
26- // Uses precedence: safe-outputs global github-token > top-level github-token > default
27- func (c * Compiler ) addSafeOutputGitHubToken (steps * []string , data * WorkflowData ) {
28- var safeOutputsToken string
29- if data .SafeOutputs != nil {
30- safeOutputsToken = data .SafeOutputs .GitHubToken
31- }
32- effectiveToken := getEffectiveGitHubToken (safeOutputsToken , data .GitHubToken )
33- * steps = append (* steps , fmt .Sprintf (" github-token: %s\n " , effectiveToken ))
34- }
35-
36- // addSafeOutputGitHubTokenForConfig adds github-token to the with section, preferring per-config token over global
37- // Uses precedence: config token > safe-outputs global github-token > top-level github-token > default
38- func (c * Compiler ) addSafeOutputGitHubTokenForConfig (steps * []string , data * WorkflowData , configToken string ) {
39- var safeOutputsToken string
40- if data .SafeOutputs != nil {
41- safeOutputsToken = data .SafeOutputs .GitHubToken
42- }
43- // Get effective token using double precedence: config > safe-outputs, then > top-level > default
44- effectiveToken := getEffectiveGitHubToken (configToken , getEffectiveGitHubToken (safeOutputsToken , data .GitHubToken ))
45- * steps = append (* steps , fmt .Sprintf (" github-token: %s\n " , effectiveToken ))
46- }
47-
48- // addSafeOutputCopilotGitHubTokenForConfig adds github-token to the with section for Copilot-related operations
49- // Uses precedence: config token > safe-outputs global github-token > top-level github-token > COPILOT_GITHUB_TOKEN > COPILOT_CLI_TOKEN > GH_AW_COPILOT_TOKEN (legacy) > GH_AW_GITHUB_TOKEN (legacy)
50- func (c * Compiler ) addSafeOutputCopilotGitHubTokenForConfig (steps * []string , data * WorkflowData , configToken string ) {
51- var safeOutputsToken string
52- if data .SafeOutputs != nil {
53- safeOutputsToken = data .SafeOutputs .GitHubToken
54- }
55- // Get effective token using double precedence: config > safe-outputs, then > top-level > Copilot default
56- effectiveToken := getEffectiveCopilotGitHubToken (configToken , getEffectiveCopilotGitHubToken (safeOutputsToken , data .GitHubToken ))
57- * steps = append (* steps , fmt .Sprintf (" github-token: %s\n " , effectiveToken ))
58- }
15+ // Note: addCustomSafeOutputEnvVars, addSafeOutputGitHubToken, addSafeOutputGitHubTokenForConfig,
16+ // and addSafeOutputCopilotGitHubTokenForConfig have been moved to safe_outputs_env_helpers.go
5917
6018// extractYAMLValue extracts a scalar value from the frontmatter map
6119func (c * Compiler ) extractYAMLValue (frontmatter map [string ]any , key string ) string {
0 commit comments