To provide some context, Drone emulates environment substitution and can replace ${var} in the yaml with a list of pre-defined variables (which includes most of the variables in this list). If the variable does not exist or is empty, it is replaced with an empty string. If you do not want a variable to be replaced, it can be escaped as $${var}. This behavior was inspired by docker-compose.
In your example yaml, you are attempting to expand the pipeline step name. The step name is not known until after the yaml is parsed. Since the emulated substitution occurs before the yaml is parsed, attempting to use this value would always result in blank substitution.
Instead of relying on emulated substitution, you can create the environment variable at runtime in your command sections. Just remember to escape the variables (as shown below) to ensure they are ignored by the emulated substitution.
steps:
- name: step1
image: "python:3.8-slim"
commands:
- export MYVAR=DRONE_STEP_NAME=$${DRONE_STEP_NAME}, DRONE_STEP_NUMBER=$${DRONE_STEP_NUMBER}"
- env | egrep "MYVAR|STEP"