Expose workflow name in the environment variables
F
Fenster
Some jobs might benefit of knowing in which workflow they are being run (e.g. nightly build or regular CI). Right now it's possible to get this information by making an API call to
and take it from there, but it would make it a lot easier if it's available as an environment variable (e.g. CIRCLE_WORKFLOW_NAME).
(I also found this feature request https://discuss.circleci.com/t/expose-workflow-name-as-environment-variable/19470 on the same topic)
CCI-I-295
M
Manuel Fittko
no progress on that front? I want to know whether I am on a scheduled workflow, I know it's possible to use a special job for this in order to add an environment variable, but it would be way easier and cleaner just to be able to read the name of the scheduled workflow
N
Nick Griffin
This would be particularly useful when defining jobs within orbs, and wanting things like cache keys to be built off the workflow name without passing in yet another parameter for it. We already have the job and repo/project name, so it's a shame that the workflow is missing still after 4+ years.
Alvina Lakhani
Any solution for this? I am facing an issue were getting the workflow name is crucial. What workaround did you use?
Mikhail Tymchuk
Super useful feature. This will allow to avoid API calls, because we collect build statistics by workflows, and cannot group by workflow name using the data available in environment variables.
C
Christian Haller
fetch it with nodejs https://gist.github.com/christianhaller3000/8cd32b31214fbe93393972e5a2e6250e
C
Christian Haller
This would be great
A
Adrien Cabarbaye
Really useful indeed for the reasons mentioned above: a could way to differentiate between nightly workflows and others
G
Graham Williamson
Yes it would be very useful. Should be really easy considering there's already the following environment vars
CIRCLE_JOBCIRCLE_WORKFLOW_IDCIRCLE_WORKFLOW_JOB_ID
T
Tim Gilbert
This would be super helpful to me (along with a variable with the URL of the workflow on CircleCI). What I want to do is post a message in Slack (from a script) when one of my builds is waiting for an approval.