Skip to content

Instantly share code, notes, and snippets.

@alexislefebvre
Last active February 2, 2021 05:10
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexislefebvre/597ad49e5f60e804ea2d45b73de9967d to your computer and use it in GitHub Desktop.
Save alexislefebvre/597ad49e5f60e804ea2d45b73de9967d to your computer and use it in GitHub Desktop.
Skip builds on Travis CI with "[skip travis]"
sudo: false
language: php
git:
depth: 5
php:
- 7.0
before_install:
- if echo "$TRAVIS_COMMIT_MESSAGE" | grep -F -q "[skip travis]" ; then echo "[skip travis] has been found, exiting" && exit 0 ; else echo "[skip travis] has not been found, continuing" ; fi
script:
- echo "OK, I should not see this"
@alexislefebvre
Copy link
Author

alexislefebvre commented Jan 18, 2017

Why did I created this gist? See travis-ci/travis-ci#5032

Results:

Ways to improve this:

  • support [skip travis] or [travis skip], for people who forget the order of words
  • find a cleaner way to get the last commit, because git show -s HEAD displays the author name and the date. Someone may be able to skip builds by using [skip travis] as its author name

@alexislefebvre
Copy link
Author

Update: use $TRAVIS_COMMIT_MESSAGE instead of git show -s HEAD

Source: travis-ci/travis-build#936

@bashtage
Copy link

This doesn't work for skipping pull requests that have [skip travis] in the commit message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment