Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 700
mosaad Avatar asked Jul 03 '17 21:07

mosaad


People also ask

How do you trigger a Travis CI build?

Trigger Travis CI builds using the API V3 by sending a POST request to /repo/{slug|id}/requests : Get an API token from your Travis CI settings page. You'll need the token to authenticate most of these API requests.

Which of the following type of commands are supported by Travis CLI?

There are three types of commands: Non-API Commands, General API Commands and Repository Commands. All commands take the form of travis COMMAND [ARGUMENTS] [OPTIONS] .

Which of the following file is used to configure the Travis CI?

Configuration. Travis CI is configured by adding a file named . travis. yml , which is a YAML format text file, to the root directory of the repository.


1 Answers

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 ;
like image 196
running.t Avatar answered Oct 06 '22 06:10

running.t