From bb4e9b6e11c3f40a1b91d35cf74b6b232f3ac809 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 19:01:03 +0000 Subject: [PATCH 1/2] Initial plan From c89f3523989652650e34ed9686bb0aee466a826f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 19:11:42 +0000 Subject: [PATCH 2/2] Add GH_AW_PROJECT_URL to main safe outputs handler This ensures that the missing_data handler and other non-project safe outputs can access the default project URL when a workflow has a project configured in frontmatter. Previously, GH_AW_PROJECT_URL was only available to project-specific handlers (update_project, create_project_status_update). Fixes workflow run: https://github.com/githubnext/gh-aw/actions/runs/21527086220 Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- .github/workflows/dependabot-burner.lock.yml | 1 + pkg/workflow/compiler_safe_outputs_steps.go | 9 ++++++ .../compiler_safe_outputs_steps_test.go | 30 +++++++++++++++---- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dependabot-burner.lock.yml b/.github/workflows/dependabot-burner.lock.yml index e15632482d..a43aa2dec4 100644 --- a/.github/workflows/dependabot-burner.lock.yml +++ b/.github/workflows/dependabot-burner.lock.yml @@ -1481,6 +1481,7 @@ jobs: GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} GH_AW_TEMPORARY_PROJECT_MAP: ${{ steps.process_project_safe_outputs.outputs.temporary_project_map }} GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_issue\":{\"max\":5},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1}}" + GH_AW_PROJECT_URL: "https://github.com/orgs/githubnext/projects/144" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | diff --git a/pkg/workflow/compiler_safe_outputs_steps.go b/pkg/workflow/compiler_safe_outputs_steps.go index eba2a8fcf7..1c7cbca540 100644 --- a/pkg/workflow/compiler_safe_outputs_steps.go +++ b/pkg/workflow/compiler_safe_outputs_steps.go @@ -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 diff --git a/pkg/workflow/compiler_safe_outputs_steps_test.go b/pkg/workflow/compiler_safe_outputs_steps_test.go index 38495bad45..61b887ab18 100644 --- a/pkg/workflow/compiler_safe_outputs_steps_test.go +++ b/pkg/workflow/compiler_safe_outputs_steps_test.go @@ -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", @@ -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 } @@ -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)