New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting job environment dynamically doesn't work when using key-value format #998
Comments
There are a couple of outstanding SO questions that relate to this too: At the moment I'm working around it by using an IF statement:
But this of course means duplicating most of the code in the workflow. |
Thanks for the report! We support expressions only in https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-using-environment-name-and-url with mappings.
|
Will being able to dynamically specify environment name be added at any point? This makes selecting an environment from a |
This issue is causing me to have to duplicate workflow files pointlessly. |
Namaste
Sorry
Sho ne tak
To da
GOLOVA
Ne hvataet sil
Grustno<<<●nashu●>>> planetu
Cheloveki zasrali vse veka ECOLOG I YA I mi I oni ii vi ta ni po mne voina
***@***.***°o°Bra
нд, 26 бер. 2023 р., 18:17 користувач Gordon MacPherson <
***@***.***> пише:
… This issue is causing me to have to duplicate workflow files pointlessly.
—
Reply to this email directly, view it on GitHub
<#998 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5YOH7KBYLZZRH6GZCDPROLW6BT2BANCNFSM4YIMM43Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
It's not possible to set the env using input variables - actions/runner#998
You already can, you just have to explicitly write it as environment:
name: ${{ some.dynamic.expression }} ... rather than |
do you have some example ? |
i have also had some luck without leveraging the name property using the "format" expression:
will finish as "dynamicValue_child_one_environment" |
This worked for me. on:
workflow_dispatch:
inputs:
environment:
required: true
type: environment
jobs:
deploy:
name: Deploy
environment:
name: ${{ inputs.environment }} |
Describe the bug
I was trying to set the job environment dynamically so I can use my GitHub production & staging environment secrets in a single workflow.
To Reproduce
Steps to reproduce the behavior:
See failing workflow: failure.yaml
Expected behavior
The environment should be set to production.
What's not working?
I get the below error:
The workflow is not valid. .github/workflows/job-environment-test-ko.yml (Line: 15, Col: 18): Unrecognized named-value: 'needs'. Located at position 1 within expression: needs.set_environment.outputs.en
Workaround found
Using object format for jobs environment fixes the issue
See successful workflow: success.yaml
The text was updated successfully, but these errors were encountered: