CircleCI Ideas

Expose workflow name in the environment variables

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 

https://circleci.com/api/v1.1/project/github/
${CIRCLE_PROJECT_USERNAME}/
${CIRCLE_PROJECT_REPONAME}/
${CIRCLE_BUILD_NUM}

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)

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Mar 15 2018
  • Taking votes
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    June 14, 2018 16:16

    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.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    November 02, 2018 00:42

    Yes it would be very useful. Should be really easy considering there's already the following environment vars

    CIRCLE_JOB
    CIRCLE_WORKFLOW_ID
    CIRCLE_WORKFLOW_JOB_ID