From bdbcbd6ca456a5204e72742e5aa56bf224af8ed8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:18:11 +0000 Subject: [PATCH 1/5] Initial plan From 83ca91fb53a80bc7a6cd7d4c0c2634474026a523 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:39:04 +0000 Subject: [PATCH 2/5] fix: add inputs.* to env var lookup in evaluateExpression for workflow_call support Agent-Logs-Url: https://github.com/github/gh-aw/sessions/6ecc8f79-7b24-4d36-81e2-29172be6114e Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/runtime_import.cjs | 5 ++-- actions/setup/js/runtime_import.test.cjs | 29 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/actions/setup/js/runtime_import.cjs b/actions/setup/js/runtime_import.cjs index 91c6a109027..7d9a9ad5b4f 100644 --- a/actions/setup/js/runtime_import.cjs +++ b/actions/setup/js/runtime_import.cjs @@ -270,10 +270,11 @@ function evaluateExpression(expr) { return evaluateExpression(rightExpr); } - // Check if this is a needs.* or steps.* expression that should be looked up from environment variables + // Check if this is a needs.*, steps.*, or inputs.* expression that should be looked up from environment variables // The compiler extracts these expressions and makes them available as GH_AW_* environment variables // For example: needs.search_issues.outputs.issue_list → GH_AW_NEEDS_SEARCH_ISSUES_OUTPUTS_ISSUE_LIST - if (trimmed.startsWith("needs.") || trimmed.startsWith("steps.")) { + // For inputs: inputs.errors → GH_AW_INPUTS_ERRORS (works for both workflow_dispatch and workflow_call) + if (trimmed.startsWith("needs.") || trimmed.startsWith("steps.") || trimmed.startsWith("inputs.")) { // Convert expression to environment variable name // e.g., "needs.search_issues.outputs.issue_list" → "GH_AW_NEEDS_SEARCH_ISSUES_OUTPUTS_ISSUE_LIST" const envVarName = "GH_AW_" + trimmed.toUpperCase().replace(/\./g, "_"); diff --git a/actions/setup/js/runtime_import.test.cjs b/actions/setup/js/runtime_import.test.cjs index 2c6c83f7feb..573db2a2aed 100644 --- a/actions/setup/js/runtime_import.test.cjs +++ b/actions/setup/js/runtime_import.test.cjs @@ -864,6 +864,35 @@ describe("runtime_import", () => { } }); + it("should return env var value for inputs.* expressions when set (workflow_call)", () => { + process.env.GH_AW_INPUTS_ERRORS = "some error list"; + try { + expect(evaluateExpression("inputs.errors")).toBe("some error list"); + } finally { + delete process.env.GH_AW_INPUTS_ERRORS; + } + }); + + it("should return empty string for inputs.* env var set to empty", () => { + process.env.GH_AW_INPUTS_BRANCH = ""; + try { + expect(evaluateExpression("inputs.branch")).toBe(""); + } finally { + delete process.env.GH_AW_INPUTS_BRANCH; + } + }); + + it("should prefer env var over context.payload.inputs for inputs.* expressions", () => { + // When both env var and payload.inputs are set, env var should win + // This ensures workflow_call inputs (delivered via env vars) are resolved correctly + process.env.GH_AW_INPUTS_REPOSITORY = "env-value"; + try { + expect(evaluateExpression("inputs.repository")).toBe("env-value"); + } finally { + delete process.env.GH_AW_INPUTS_REPOSITORY; + } + }); + it("should handle missing properties gracefully", () => { const result = evaluateExpression("github.event.nonexistent.property"); expect(result).toContain("github.event.nonexistent.property"); From 7a9d5d44f5ddbc7ecdd1082982622ff60f9d4c13 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:40:40 +0000 Subject: [PATCH 3/5] fix: improve test and comment per code review feedback Agent-Logs-Url: https://github.com/github/gh-aw/sessions/6ecc8f79-7b24-4d36-81e2-29172be6114e Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/runtime_import.cjs | 4 +++- actions/setup/js/runtime_import.test.cjs | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/actions/setup/js/runtime_import.cjs b/actions/setup/js/runtime_import.cjs index 7d9a9ad5b4f..8f3eb50f32e 100644 --- a/actions/setup/js/runtime_import.cjs +++ b/actions/setup/js/runtime_import.cjs @@ -273,7 +273,9 @@ function evaluateExpression(expr) { // Check if this is a needs.*, steps.*, or inputs.* expression that should be looked up from environment variables // The compiler extracts these expressions and makes them available as GH_AW_* environment variables // For example: needs.search_issues.outputs.issue_list → GH_AW_NEEDS_SEARCH_ISSUES_OUTPUTS_ISSUE_LIST - // For inputs: inputs.errors → GH_AW_INPUTS_ERRORS (works for both workflow_dispatch and workflow_call) + // For inputs: inputs.errors → GH_AW_INPUTS_ERRORS + // This is required for workflow_call where inputs are not in context.payload.inputs; + // for workflow_dispatch, context.payload.inputs is populated but the env var lookup takes precedence. if (trimmed.startsWith("needs.") || trimmed.startsWith("steps.") || trimmed.startsWith("inputs.")) { // Convert expression to environment variable name // e.g., "needs.search_issues.outputs.issue_list" → "GH_AW_NEEDS_SEARCH_ISSUES_OUTPUTS_ISSUE_LIST" diff --git a/actions/setup/js/runtime_import.test.cjs b/actions/setup/js/runtime_import.test.cjs index 573db2a2aed..8c2593bac3d 100644 --- a/actions/setup/js/runtime_import.test.cjs +++ b/actions/setup/js/runtime_import.test.cjs @@ -885,11 +885,14 @@ describe("runtime_import", () => { it("should prefer env var over context.payload.inputs for inputs.* expressions", () => { // When both env var and payload.inputs are set, env var should win // This ensures workflow_call inputs (delivered via env vars) are resolved correctly + // even when workflow_dispatch also populates context.payload.inputs + global.context.payload.inputs = { repository: "context-value" }; process.env.GH_AW_INPUTS_REPOSITORY = "env-value"; try { expect(evaluateExpression("inputs.repository")).toBe("env-value"); } finally { delete process.env.GH_AW_INPUTS_REPOSITORY; + delete global.context.payload.inputs; } }); From 2f2822d225fd811a4f328f6f2832f2a13710f32b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 01:02:13 +0000 Subject: [PATCH 4/5] test: add regression tests for hyphenated inputs.* expressions (e.g., inputs.task-description) Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e3f3fdcf-ef32-4571-8ae0-be0973cdd2bb Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/runtime_import.test.cjs | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/actions/setup/js/runtime_import.test.cjs b/actions/setup/js/runtime_import.test.cjs index 8c2593bac3d..2b22f19dfee 100644 --- a/actions/setup/js/runtime_import.test.cjs +++ b/actions/setup/js/runtime_import.test.cjs @@ -896,6 +896,36 @@ describe("runtime_import", () => { } }); + it("should resolve hyphenated inputs.* via context.payload.inputs fallback", () => { + // Hyphenated input names (e.g., inputs.task-description) are exported by the compiler + // as GH_AW_EXPR_ (hash-based) rather than GH_AW_INPUTS_TASK-DESCRIPTION (simple). + // The simple env var lookup won't match, so the expression falls through to + // context.payload.inputs, which works for workflow_dispatch. + global.context.payload.inputs = { "task-description": "fix the bug" }; + try { + expect(evaluateExpression("inputs.task-description")).toBe("fix the bug"); + } finally { + delete global.context.payload.inputs; + } + }); + + it("should resolve hyphenated inputs.* via hash-based GH_AW_EXPR_ env var when set directly", () => { + // For workflow_call, context.payload.inputs is empty, so the compiler provides the + // value via a hash-based env var (e.g., GH_AW_EXPR_B3924FAD). The "Substitute placeholders" + // step resolves these in the heredoc-inlined portions; runtime-import expressions rely + // on the context fallback or having the env var set under the simple-conversion name. + // This test documents that if the hash-based env var is set, the simple lookup won't find it, + // and resolution falls through to context. + global.context.payload.inputs = {}; + try { + const result = evaluateExpression("inputs.task-description"); + // Without context.payload.inputs populated, the expression is not resolved + expect(result).toContain("inputs.task-description"); + } finally { + delete global.context.payload.inputs; + } + }); + it("should handle missing properties gracefully", () => { const result = evaluateExpression("github.event.nonexistent.property"); expect(result).toContain("github.event.nonexistent.property"); From e27a871bd5f8e185bebe1bb60dd383f9b316fee8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 01:03:21 +0000 Subject: [PATCH 5/5] test: improve hyphenated inputs test names for clarity Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e3f3fdcf-ef32-4571-8ae0-be0973cdd2bb Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/runtime_import.test.cjs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/actions/setup/js/runtime_import.test.cjs b/actions/setup/js/runtime_import.test.cjs index 2b22f19dfee..53c35c0b8f7 100644 --- a/actions/setup/js/runtime_import.test.cjs +++ b/actions/setup/js/runtime_import.test.cjs @@ -909,17 +909,15 @@ describe("runtime_import", () => { } }); - it("should resolve hyphenated inputs.* via hash-based GH_AW_EXPR_ env var when set directly", () => { - // For workflow_call, context.payload.inputs is empty, so the compiler provides the - // value via a hash-based env var (e.g., GH_AW_EXPR_B3924FAD). The "Substitute placeholders" - // step resolves these in the heredoc-inlined portions; runtime-import expressions rely - // on the context fallback or having the env var set under the simple-conversion name. - // This test documents that if the hash-based env var is set, the simple lookup won't find it, - // and resolution falls through to context. + it("should not resolve hyphenated inputs.* when context.payload.inputs is empty", () => { + // For workflow_call, context.payload.inputs is empty. Hyphenated input names + // can't be resolved via the simple env var conversion (which produces + // GH_AW_INPUTS_TASK-DESCRIPTION instead of the compiler's GH_AW_EXPR_). + // The compiler handles this via placeholder substitution in the heredoc-inlined + // prompt; runtime-import expressions rely on context.payload.inputs. global.context.payload.inputs = {}; try { const result = evaluateExpression("inputs.task-description"); - // Without context.payload.inputs populated, the expression is not resolved expect(result).toContain("inputs.task-description"); } finally { delete global.context.payload.inputs;