Using the Commit message as a pipeline step condition

Hi,

I’m looking for a feature where I can run a pipeline step based on the contents of the commit message. There are many options when it comes to Drone pipeline conditions, but none that enables me to “peek” into the message.

(My use case is that for some commits in a repository that controls deployments in dev/staging/prod, I want to notify a slack channel that a commit was made & the build passed. Basically announcing the only relevant deploys we make in our team. Having the drone-slack plugin send us a message for every commit will be very spammy and not useful.)

So far, I have made PR in the drone-slack plugin (Add setting to only match certain commits by fredrikwangberg · Pull Request #121 · drone-plugins/drone-slack · GitHub), but recieved feedback that this way of controlling the plugin behaviour is better at a “higher” level - hence my post here.

Finally, for reference, these are the other two discussions/PRs I found related to this subject. Neither of them seem to be “final” - i.e. clearly dictating if this is something Drone could support in the future or not.

Best,
Fredrik

Hello!
I found a way to refer to commit message in stage/step conditions

<+eventPayload.head_commit.message>.contains('[my message]')

Using this condition for stage:

  • it is being skipped when commit message foo foo
  • it is being executed when message foo [my message] foo