Dynamic Job names?

We have a workflow with jobs like this:

name: promote to env

jobs:
  promote:
    name: promote

We have a mono repo and it would be really helpful to tell which service in the repo got promoted. Is there any way to dynamically change the name. We have a bunch of services and 3 environments and its hard to track which promote job/step was for which environment.

Like for instance to do something like this?

name: promote to {{env.deployEnvironment}} jobs: promote: name: promote to {{env.deployEnvironment}}

You can definitely use the matrix context for dynamic job names:

Not entirely sure about the env context, but you should give it a try.

1 Like

@adadkins,

The workflow name defined in the workflow file is fixed, and we seem can’t change it dynamically during the workflow run.

For the job names step names, we can change them dynamically during the workflow run.
As @Simran-B suggested, you can use the Contexts to set the dynamic job names and step names.

About the env context, you can only use it in the scenarios below:

  • the value of the with key;
  • the value of the step’s name key;
  • the value of the step’s env key;
  • in a step’s if conditional;
  • in the command lines of a run step.