mosaad
mosaad

Reputation: 2371

trigger travis CI build only with specific commit message

I want travis to start only if I have a certian commit message. how can i do this. My travis.yml file is here

I know there is an on condition from this question but I dont know where to put it.

Upvotes: 5

Views: 2701

Answers (1)

running.t
running.t

Reputation: 5709

The question you mentioned regards deploying travis build. So on: condition only determines if build is deployed or not. Regardless this setting other build steps are executed on each commit/pull request.

What you could use instead is adding [ci skip] or [skip ci] in commit messages to force build skipping.

You can also use TRAVIS_COMMIT_MESSAGE default env variable in all your build steps to determine if step should be executed or skipped, e.g.

 script: if [[ $TRAVIS_COMMIT_MESSAGE == *"trigger build"* ]]; then mvn install ; fi ;

Upvotes: 6

Related Questions