Can't set environment variable from secret

Hello all,

I’m trying to pass in a secret value to my script that’s running using a composite run step, but I’m getting the following error message:

"Unrecognized named-value: 'secrets'.

Here’s the yaml file: https://github.com/php-actions/composer/blob/434c409f860b690aa093760b78cdb252e78dd5d9/action.yml#L95-L96

As you can see, I’m successfully passing a few environment variables into the script from the value of the Action’s input parameters, but I can’t figure out how to set the environment variables from secrets.

Am I doing something wrong? Is there a bug with Github actions?

Any help will be appreciated, thanks!

Here’s an example repository running this action: https://github.com/php-actions/example-phpunit/runs/1485735187

It looks like you’re trying to use secrets from inside an action definition file rather than inside a workflow. Secrets aren’t available directly inside a custom action, they need to be passed into a custom action input from a workflow file.

You should be able to define these as an input inside your action.yml and then pass your required secrets to this action from inside the workflow file you’re using this action in.

3 Likes