Disable Travis CI build in .travis.yml

I think I found 2 ways of doing, neither are ideal…

[ci skip] or [skip ci] to a commit message - this would become tedious…

disable builds in the TravisCI.com interface - requires logging in to TravisCI to turn it on/off, or even see if it’s on/off

what I’m looking for is a way to disable builds for a few days at a time, in my project, without completely deleting the .travis.yml file?

is it possible to disable Travis builds via a config setting in .travis.yml ?

Something like this:

enabled: false             // Travis CI builds turned off
language: node_js
node_js:
  - "stable"
deploy:
  provider: heroku
  api_key:
    secure: [KEY]
  app: [APP-NAME]

If you do not create any job (or in a paradoxical case, creates too many) in your .travis.yml, the build request will be rejected.

For example:

language: ruby
rvm: '2.4'
matrix:
  exclude:
    rvm: '2.4'

This may be impractical depending on how complex your intended configuration is. From the sound of it, it sounds like it’s a more complex setup. If that’s the case you’d probably want to use the Travis CLI client. Check the following links out.

https://github.com/travis-ci/travis.rb#enable
https://github.com/travis-ci/travis.rb#disable

1 Like

The easiest way that I’ve found to disable Travis for a project temporarily is to disable both push and pull request builds in the project’s settings: https://app.travis-ci.com/github/<user>/<project>/settings.

When I work with public repos, there’s also the “consume paid credits for OSS” switch at Travis CI - Test and Deploy with Confidence, switching it off disables Travis for all my public repos.

Back at travis-ci.org, there used to be a convenient switch next to each project in the project list but no more.

2 Likes