Concurrency group does not support environmental variables? #26308
-
Just checking to see if others can confirm or refute my analysis here. It seems that concurrency group does not support environmental variables? Given this segment in one of my workflow files:
I get this Annotation error:
I would like to use environment variables to stay D.R.Y. as I also use that variable elsewhere, but it seems maybe the GitHub Actions developers have to explicit implement every feature for every other feature, i.e. environment vars within concurrency, in this case? Can anyone confirm this, or help me understand what I might be doing wrong? And if in fact concurrency does not currently support environmental variables, what is the appropriate repo where I can submit an issue and/or maybe even a pull request? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments
-
This is documented in the description of the
|
Beta Was this translation helpful? Give feedback.
-
Thank you for the reply and explanation. Is there any other way to define constants that would be in scope throughout the entirety of the YAML file? -Mike |
Beta Was this translation helpful? Give feedback.
-
For workflow-level |
Beta Was this translation helpful? Give feedback.
-
Thanks again, but unfortunately that does not sounds like a great option. But then your emoticon signaled that. Do you mind if I ask my seconds question again from my original post?
|
Beta Was this translation helpful? Give feedback.
-
Considering that this is about the workflow syntax itself, I guess the Actions section of the community organization discussions would be the right place: Discussions · github-community · GitHub |
Beta Was this translation helpful? Give feedback.
-
Thank you for the reply! |
Beta Was this translation helpful? Give feedback.
-
You could make use of reusable workflows to achieve what you’re trying to do. caller.yml
called.yml
|
Beta Was this translation helpful? Give feedback.
-
Hi @nicholasbergesen — Thank you for taking the time to offer a suggestion. The irony of your suggestion, though, is that is exactly what I was doing prior to running into the unworkable limitations of reusable workflows and thus had to unravel that work and just go back to independent workflow files. And it was there I found myself trying to use environment variables as an alternative to the Seems I am damned if I do, damned if I don’t! So I made this feature request. |
Beta Was this translation helpful? Give feedback.
-
An alternative workaround could be to use secrets. Add a secret in the repo/org and then reference it in the workflow using ${{ secrets.EXTERNAL_SERVER_IP }}. This would make the value accessible throughout the workflow similar to the behavior of |
Beta Was this translation helpful? Give feedback.
-
Hi @nicholasbergesen — Thank you again for the suggestion. Yes, secrets are certainly a creative stand-in for constants. Unfortunately for my use-case they are unworkable for a few reasons:
So yes, I agree secrets are a great workaround for constants when someone 1.) does not need to see the value while or after running a workflow and 2.) they have admin permissions to add and manage secrets themselves. Unfortunately, for my use-case however, using secrets ends up being a non-starter. -Mike |
Beta Was this translation helpful? Give feedback.
-
Hi @nicholasbergesen — Thanks to your persistence in trying to identify a workaround for me you inspired me to search the docs to see if there were any other potentials solutions to address this need that actually fit my use-case. And lo-and-behold, there is! I was able to create a matrix strategy with one option like the following workflow snippet, and it worked!
Just thought I would close the loop on this for the benefit of anyone in the future who has the same need and googles for a solution. Still, adding a constant feature to Gihub Action workflows would be much better as a |
Beta Was this translation helpful? Give feedback.
-
That’s a really creative solution, it never crossed my mind to do that. I’m glad you’ve found a way forward! Thank you for sharing it. |
Beta Was this translation helpful? Give feedback.
Hi @nicholasbergesen —
Thanks to your persistence in trying to identify a workaround for me you inspired me to search the docs to see if there were any other potentials solutions to address this need that actually fit my use-case. And lo-and-behold, there is!
I was able to create a matrix strategy with one option like the following workflow snippet, and it worked!
Just thought I would close the loop on this for the benefit of anyone in the future who has the same need and googles for a solution.
Still, adding a constant feature to Gihub Action wo…