Cron Jobs

Cron jobs are still in BETA. There is more information about what this means, and how you can give us feedback on this new feature in the GitHub issue.

Cron jobs run builds at regular scheduled intervals independently of whether any commits were pushed to the repository. When they run, cron jobs always fetch the most recent commit on a particular branch and build the project at that state. Cron jobs can run daily, weekly or monthly, which in practice means up to an hour after the selected time span, and they can also be skipped. Cron jobs cannot be set to run at specific times.

Cron job builds use the same notification settings as normal push builds.

Configure cron jobs from the “Cron Jobs” settings tab on your Travis CI page.

settings page with cron section

If your API or cron triggered builds run on the same commit or branch over and over again, you will notice GitHub have a limit of 1000 status updates per commit, which causes the Travis CI build status displayed on GitHub to be incorrect. Avoid this problem by specifying a regularly updated branch for your automated builds.

Adding Cron Jobs

Select the branch to run the build on, how often to run the build, and whether to run the build if there was a build in the last 24 hours, then click “Add”:

adding a cron job

Confirm that the cron job is displayed in your settings tab:

cron job created

Skipping Cron Jobs

Because cron jobs build the latest commit to a particular branch, if that commit message includes [ci skip] or [skip ci] the cron job will skip that build.

Deleting Cron Jobs

Click the small trash icon on the right hand side of the page:

deleting a cron job

Detecting Builds Triggered by Cron

To check whether a build was triggered by cron, examine the TRAVIS_EVENT_TYPE environment variable to see if it has the value cron.