Composite action inputs inside a shell script

Hello!
How can I access composite action inputs inside a shell script?

${{ inputs.input_name }}

and

$INPUT_INPUT_NAME

not working inside a shell script!

For example:
action.yml

inputs:
  test_input:
    name: "Test input"
runs:
  using: 'composite'
  steps:
    - run: ${{ github.action_path }}/entrypoint.sh
      shell: bash

entrypoint.sh

echo ${{ inputs.test_input }} 
echo $INPUT_TEST_INPUT
1 Like

I’ve had that issue, too, unfortunately the bug report is still unresolved:

Use env as a workaround, e.g.:

    - run: ${{ github.action_path }}/entrypoint.sh
      shell: bash
      env:
        INPUT_TEST_INPUT: ${{ inputs.test_input }}
2 Likes

thanks for workaround! :star_struck:
Is it safe to pass secrets in env from inputs?
For example:

- run: ${{ github.action_path }}/entrypoint.sh
  shell: bash
  env:
    SUPER_SECRET: ${{ inputs.super_secret }}
1 Like

The SUPER_SECRET environment variable will be available to everything called from the command(s) defined in the run parameter. In this case that’s your script and anything it calls (unless the script overrides the environment variable). So it depends on your script. :slightly_smiling_face:

1 Like