oNaiPs / secrets-to-env-action

Export your GitHub Actions secrets to environment variables
MIT License
86 stars 29 forks source link

Remove prefix #294

Open ThorHen opened 6 months ago

ThorHen commented 6 months ago

Hi,

Not entirely sure whether this is already supported or not.

Is it in some way possible to remove a specified prefix from the secret names, before adding them as environment variables?

Kind of the inverse of the prefix option specified in the readme.

Really neat action!

Example

GitHub Secrets

MY_PREFIXED_SECRET_1 = ABC MY_PREFIXED_SECRET_2 = DEF

YML

steps:
- uses: actions/checkout@v3
- uses: oNaiPs/secrets-to-env-action@v1
  with:
    secrets: ${{ toJSON(secrets) }}
    include: my_prefixed_* # Should include both MY_PREFIXED_SECRET_1 and MY_PREFIXED_SECRET_2 
    remove_prefix: my_prefixed_

- run: echo "Value of SECRET_1: $SECRET_1"
JackMBurch commented 2 months ago

Yeah, this would be helpful