File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,7 @@ function evaluateExpression(expr) {
277277 // e.g., "needs.search_issues.outputs.issue_list" → "GH_AW_NEEDS_SEARCH_ISSUES_OUTPUTS_ISSUE_LIST"
278278 const envVarName = "GH_AW_" + trimmed . toUpperCase ( ) . replace ( / \. / g, "_" ) ;
279279 const envValue = process . env [ envVarName ] ;
280- if ( envValue !== undefined && envValue !== null && envValue !== "" ) {
280+ if ( envValue !== undefined && envValue !== null ) {
281281 return envValue ;
282282 }
283283 // If not found in environment, continue to try other evaluation methods below
Original file line number Diff line number Diff line change @@ -768,6 +768,30 @@ describe("runtime_import", () => {
768768 expect ( evaluateExpression ( "steps.test.outputs.result" ) ) . toContain ( "steps.test.outputs.result" ) ;
769769 } ) ;
770770
771+ it ( "should return empty string when env var is set to empty (e.g. workflow_dispatch with no text)" , ( ) => {
772+ process . env . GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT = "" ;
773+ try {
774+ expect ( evaluateExpression ( "steps.sanitized.outputs.text" ) ) . toBe ( "" ) ;
775+ } finally {
776+ delete process . env . GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT ;
777+ }
778+ } ) ;
779+
780+ it ( "should return env var value for needs/steps expressions when set" , ( ) => {
781+ process . env . GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT = "Hello world" ;
782+ try {
783+ expect ( evaluateExpression ( "steps.sanitized.outputs.text" ) ) . toBe ( "Hello world" ) ;
784+ } finally {
785+ delete process . env . GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT ;
786+ }
787+ process . env . GH_AW_NEEDS_BUILD_OUTPUTS_VERSION = "v1.2.3" ;
788+ try {
789+ expect ( evaluateExpression ( "needs.build.outputs.version" ) ) . toBe ( "v1.2.3" ) ;
790+ } finally {
791+ delete process . env . GH_AW_NEEDS_BUILD_OUTPUTS_VERSION ;
792+ }
793+ } ) ;
794+
771795 it ( "should handle missing properties gracefully" , ( ) => {
772796 const result = evaluateExpression ( "github.event.nonexistent.property" ) ;
773797 expect ( result ) . toContain ( "github.event.nonexistent.property" ) ;
You can’t perform that action at this time.
0 commit comments