Sanitizing name of branch

Hello there :slight_smile: am trying to sanitize a branch name from dashes and full-stops in the following way.

commands:
  - echo ${DRONE_BRANCH//([-.])/_}

However, Drone does not seem to apply the transformation. If I try running the same build with this instead:

echo ${DRONE_BRANCH//-/_}

Everything seems to be working properly. Additionally, is there a way to replace the detected characters with blank instead of underscore. This also seems to work locally on Terminal but not on Drone.

Do you have any ideas? Thank you!

1 Like

For anybody interested, try using sed instead. Direct multi-character sanitization is not supported by the underlying infrastructure either Drone or Docker.

1 Like