Starlark string functions on drone's environment variables

Hi there,

I am trying to do this with Starlark and Drone:

ticket_num = "${DRONE_COMMIT_MESSAGE}".split(" ")[0]

This supposed to extract ticket number from the commit message e.g.
XX-123 feat(component): message.

So with the above code I could easily get XX-123 however .split function is evaluated prior to drone’s variable population and I am getting full commit message. Is there a way how to hack it?

Thank you,
Pawel S

You can only use variable substitution (e.g. ${VARIABLE}) with yaml files. If you writing your pipeline configuration in starlark you have direct access to this information in the context variable. To access the commit message you would use the ctx.build.message variable.

Amazing! thx mate @bradrydzewski