How to use `runif:` to check git last commit message

I’d like to specify in the runif: statement if last commit message contains a substring or not.
My idea is to create something like the [skip ci] pattern used by bitrise to skip CI but for a custom substring.

How can I do this?

Hi @iamfabiomilano,

Thanks for asking this question here! :wink:

So, the thing about the run_if statements is that those can’t do any computation, only “flag” checks (e.g. .IsBuildFailed) and Environment Variable comparisons.

What you can do is to combine this with e.g. a Script step, where you can do any computation you need, and then expose an Environment Variable from that Script step.

After that you can check whether an environment variable is equal to a value with run_if: '{{enveq "TEST_KEY" "test value"}}' (https://github.com/bitrise-io/bitrise/blob/master/_examples/experimentals/templates/bitrise.yml#L25)

Docs for exposing environment variables from Script steps: http://devcenter.bitrise.io/tips-and-tricks/expose-environment-variable/

If you have any questions, just let us know!

Thank you for your reply.

Making a script seems a good solution.

1 Like