@@ -275,6 +275,7 @@ async function runActionWithWitness(actionDir, witnessOptions) {
275275 mavenPOM,
276276 } = witnessOptions ;
277277
278+ // Read the nested action metadata (action.yml or action.yaml)
278279 const actionYmlPath = path . join ( actionDir , "action.yml" ) ;
279280 const actionYamlPath = path . join ( actionDir , "action.yaml" ) ;
280281 let actionConfig ;
@@ -290,31 +291,26 @@ async function runActionWithWitness(actionDir, witnessOptions) {
290291 throw new Error ( "Entry point (runs.main) not defined in action metadata" ) ;
291292 }
292293 core . info ( `Nested action entry point: ${ entryPoint } ` ) ;
294+
293295 const entryFile = path . join ( actionDir , entryPoint ) ;
294296 if ( ! fs . existsSync ( entryFile ) ) {
295297 throw new Error ( `Entry file ${ entryFile } does not exist.` ) ;
296298 }
299+
300+ // Optionally install dependencies if package.json exists
297301 const pkgJsonPath = path . join ( actionDir , "package.json" ) ;
298302 if ( fs . existsSync ( pkgJsonPath ) ) {
299303 core . info ( "Installing dependencies for nested action..." ) ;
300304 await exec . exec ( "npm" , [ "install" ] , { cwd : actionDir } ) ;
301305 }
302306
303- // FIX: Explicitly gather and inject INPUT_* variables.
304- const nestedInputs = { } ;
305- Object . keys ( process . env )
306- . filter ( key => key . startsWith ( 'INPUT_' ) )
307- . forEach ( key => {
308- const inputName = key . substring ( 6 ) . toLowerCase ( ) ;
309- nestedInputs [ inputName ] = process . env [ key ] ;
310- core . info ( `Passing input '${ inputName } ' to nested action` ) ;
311- } ) ;
312- // Merge with process.env so that the child gets all environment variables.
307+ // Build environment by merging process.env (ensuring all INPUT_* variables pass)
313308 const envVars = { ...process . env } ;
314- Object . keys ( nestedInputs ) . forEach ( name => {
315- envVars [ `INPUT_ ${ name . toUpperCase ( ) } ` ] = nestedInputs [ name ] ;
316- } ) ;
309+ // (Optionally, override specific inputs explicitly if needed)
310+ // For example:
311+ // envVars["INPUT_WHO-TO-GREET"] = core.getInput("who-to-greet" );
317312
313+ // Build the witness command argument array.
318314 const cmd = [ "run" ] ;
319315 if ( enableSigstore ) {
320316 fulcio = fulcio || "https://fulcio.sigstore.dev" ;
@@ -364,38 +360,42 @@ async function runActionWithWitness(actionDir, witnessOptions) {
364360 }
365361 if ( trace ) cmd . push ( `--trace=${ trace } ` ) ;
366362 if ( outfile ) cmd . push ( `--outfile=${ outfile } ` ) ;
367-
368- const nodeCmd = 'node' ;
363+
364+ // Build argument array for the nested action execution
365+ const nodeCmd = "node" ;
369366 const nodeArgs = [ entryFile ] ;
370- const runArray = [ "witness" , ...cmd , "--" , nodeCmd , ...nodeArgs ] ;
371- const commandString = runArray . join ( " " ) ;
372- core . info ( `Running witness command: ${ commandString } ` ) ;
373-
374- console . log ( "Environment variables for nested action:" ) ;
375- for ( const key in envVars ) {
376- console . log ( key + ": " + envVars [ key ] ) ;
377- }
378-
367+ const args = [ ...cmd , "--" , nodeCmd , ...nodeArgs ] ;
368+ core . info ( `Running witness command: witness ${ args . join ( " " ) } ` ) ;
369+
379370 const execOptions = {
380371 cwd : actionDir ,
381372 env : envVars ,
382373 listeners : {
383- stdout : data => process . stdout . write ( data . toString ( ) ) ,
384- stderr : data => process . stderr . write ( data . toString ( ) )
374+ stdout : ( data ) => process . stdout . write ( data . toString ( ) ) ,
375+ stderr : ( data ) => process . stderr . write ( data . toString ( ) )
385376 }
386377 } ;
387- let output = '' ;
388- await exec . exec ( 'sh' , [ '-c' , commandString ] , {
378+
379+ let output = "" ;
380+ // Directly call the witness binary without using a shell.
381+ await exec . exec ( "witness" , args , {
389382 ...execOptions ,
390383 listeners : {
391384 ...execOptions . listeners ,
392- stdout : data => { output += data . toString ( ) ; process . stdout . write ( data . toString ( ) ) ; } ,
393- stderr : data => { output += data . toString ( ) ; process . stderr . write ( data . toString ( ) ) ; }
385+ stdout : ( data ) => {
386+ output += data . toString ( ) ;
387+ process . stdout . write ( data . toString ( ) ) ;
388+ } ,
389+ stderr : ( data ) => {
390+ output += data . toString ( ) ;
391+ process . stderr . write ( data . toString ( ) ) ;
392+ }
394393 }
395394 } ) ;
396395 return output ;
397396}
398397
398+
399399async function runDirectCommandWithWitness ( command , witnessOptions ) {
400400 let {
401401 step,
0 commit comments