Environment name does not support matrix #26594
-
It looks like the new
I get the following error however: |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Similarly, I would expect the following to work: on: deployment
jobs:
deploy:
runs-on: ubuntu-20.04
environment: ${{ github.event.deployment.environment }}
env:
ENVIRONMENT: ${{ github.event.deployment.environment }}
steps:
- name: Deploy to ${{ github.event.deployment.environment }}
env:
FOO: ${{ secrets.FOO }}
run: echo "FOO in $ENVIRONMENT is ${FOO:0:1}+${FOO:1}" Given that an environment can have up to 100 secrets that get mapped in Additionally, because there is not an on: deployment
jobs:
deploy:
runs-on: ubuntu-20.04
env:
ENVIRONMENT: ${{ github.event.deployment.environment }}
steps:
- run: |
if [ $ENVIRONMENT = "production" ]; then
# trigger deploy-production workflow
elif [ $ENVIRONMENT = "staging" ]; then
# trigger deploy-staging workflow
elif [ $ENVIRONMENT = "develop" ]; then
# trigger deploy-develop workflow
else
# not a supported environment
fi Am I thinking about environments wrong? How is this feature intended to be used with only static strings? |
Beta Was this translation helpful? Give feedback.
-
Hello, I’m able to make this kind of setup work:
I did not test with the ‘short’ version: @ngraef you use a |
Beta Was this translation helpful? Give feedback.
-
@GregoireW You’re right, expression evaluation does work with the long form
As you mentioned, this does indeed cause an infinite loop of deployments. I have created a separate topic for that issue: Using environment secrets with deployment trigger causes infinite deployment loop |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for this answer, we were trying with setting the value of an environment with the short form as in |
Beta Was this translation helpful? Give feedback.
Hello,
I’m able to make this kind of setup work: