Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions pkg/workflow/compiler_safe_outputs_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import (
"github.com/githubnext/gh-aw/pkg/logger"
)

var compilerSafeOutputsLog = logger.New("workflow:compiler_safe_outputs_config")
var compilerSafeOutputsConfigLog = logger.New("workflow:compiler_safe_outputs_config")

func (c *Compiler) addHandlerManagerConfigEnvVar(steps *[]string, data *WorkflowData) {
if data.SafeOutputs == nil {
compilerSafeOutputsLog.Print("No safe-outputs configuration, skipping handler manager config")
compilerSafeOutputsConfigLog.Print("No safe-outputs configuration, skipping handler manager config")
return
}

compilerSafeOutputsLog.Print("Building handler manager configuration for safe-outputs")
compilerSafeOutputsConfigLog.Print("Building handler manager configuration for safe-outputs")
config := make(map[string]map[string]any)

// Add config for each enabled safe output type with their options
// Presence in config = enabled, so no need for "enabled": true field
if data.SafeOutputs.CreateIssues != nil {
compilerSafeOutputsLog.Print("Adding create_issue handler configuration")
compilerSafeOutputsConfigLog.Print("Adding create_issue handler configuration")
cfg := data.SafeOutputs.CreateIssues
handlerConfig := make(map[string]any)
if cfg.Max > 0 {
Expand Down Expand Up @@ -526,7 +526,7 @@ func (c *Compiler) addHandlerManagerConfigEnvVar(steps *[]string, data *Workflow

// Only add the env var if there are handlers to configure
if len(config) > 0 {
compilerSafeOutputsLog.Printf("Marshaling handler config with %d handlers", len(config))
compilerSafeOutputsConfigLog.Printf("Marshaling handler config with %d handlers", len(config))
configJSON, err := json.Marshal(config)
if err != nil {
consolidatedSafeOutputsLog.Printf("Failed to marshal handler config: %v", err)
Expand All @@ -535,9 +535,9 @@ func (c *Compiler) addHandlerManagerConfigEnvVar(steps *[]string, data *Workflow
// Escape the JSON for YAML (handle quotes and special chars)
configStr := string(configJSON)
*steps = append(*steps, fmt.Sprintf(" GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: %q\n", configStr))
compilerSafeOutputsLog.Printf("Added handler config env var: size=%d bytes", len(configStr))
compilerSafeOutputsConfigLog.Printf("Added handler config env var: size=%d bytes", len(configStr))
} else {
compilerSafeOutputsLog.Print("No handlers configured, skipping config env var")
compilerSafeOutputsConfigLog.Print("No handlers configured, skipping config env var")
}
}

Expand All @@ -546,11 +546,11 @@ func (c *Compiler) addHandlerManagerConfigEnvVar(steps *[]string, data *Workflow
// These handlers require GH_AW_PROJECT_GITHUB_TOKEN and are processed separately from the main handler manager.
func (c *Compiler) addProjectHandlerManagerConfigEnvVar(steps *[]string, data *WorkflowData) {
if data.SafeOutputs == nil {
compilerSafeOutputsLog.Print("No safe-outputs configuration, skipping project handler config")
compilerSafeOutputsConfigLog.Print("No safe-outputs configuration, skipping project handler config")
return
}

compilerSafeOutputsLog.Print("Building project handler manager configuration")
compilerSafeOutputsConfigLog.Print("Building project handler manager configuration")
config := make(map[string]map[string]any)

// Add config for project-related safe output types
Expand Down