Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/dependabot-burner.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions pkg/workflow/compiler_safe_outputs_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ func (c *Compiler) buildHandlerManagerStep(data *WorkflowData) []string {
// Add all safe output configuration env vars (still needed by individual handlers)
c.addAllSafeOutputConfigEnvVars(&steps, data)

// Add GH_AW_PROJECT_URL if project is configured in frontmatter
// This provides a default project URL for handlers that may need it (e.g., missing_data)
// even though they don't directly interact with projects. This ensures consistency
// across all safe output handlers when a workflow has a project configured.
if data.ParsedFrontmatter != nil && data.ParsedFrontmatter.Project != nil && data.ParsedFrontmatter.Project.URL != "" {
consolidatedSafeOutputsStepsLog.Printf("Adding GH_AW_PROJECT_URL to handler manager: %s", data.ParsedFrontmatter.Project.URL)
steps = append(steps, fmt.Sprintf(" GH_AW_PROJECT_URL: %q\n", data.ParsedFrontmatter.Project.URL))
}

// With section for github-token
// Use the standard safe outputs token for all operations
// Project-specific handlers (create_project) will use custom tokens from their handler config
Expand Down
30 changes: 25 additions & 5 deletions pkg/workflow/compiler_safe_outputs_steps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,10 @@ func TestBuildSharedPRCheckoutStepsConditions(t *testing.T) {
// TestBuildHandlerManagerStep tests handler manager step generation
func TestBuildHandlerManagerStep(t *testing.T) {
tests := []struct {
name string
safeOutputs *SafeOutputsConfig
checkContains []string
name string
safeOutputs *SafeOutputsConfig
parsedFrontmatter *FrontmatterConfig
checkContains []string
}{
{
name: "basic handler manager",
Expand Down Expand Up @@ -338,6 +339,24 @@ func TestBuildHandlerManagerStep(t *testing.T) {
"GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG",
},
},
{
name: "handler manager with project URL from frontmatter",
safeOutputs: &SafeOutputsConfig{
MissingData: &MissingDataConfig{
CreateIssue: true,
},
},
parsedFrontmatter: &FrontmatterConfig{
Project: &ProjectConfig{
URL: "https://github.com/orgs/test-org/projects/456",
},
},
checkContains: []string{
"name: Process Safe Outputs",
"id: process_safe_outputs",
"GH_AW_PROJECT_URL: \"https://github.com/orgs/test-org/projects/456\"",
},
},
// Note: create_project and create_project_status_update are now handled by
// the project handler manager (buildProjectHandlerManagerStep), not the main handler manager
}
Expand All @@ -347,8 +366,9 @@ func TestBuildHandlerManagerStep(t *testing.T) {
compiler := NewCompiler()

workflowData := &WorkflowData{
Name: "Test Workflow",
SafeOutputs: tt.safeOutputs,
Name: "Test Workflow",
SafeOutputs: tt.safeOutputs,
ParsedFrontmatter: tt.parsedFrontmatter,
}

steps := compiler.buildHandlerManagerStep(workflowData)
Expand Down