Last active
February 2, 2021 05:10
-
-
Save alexislefebvre/597ad49e5f60e804ea2d45b73de9967d to your computer and use it in GitHub Desktop.
Skip builds on Travis CI with "[skip travis]"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Update: use $TRAVIS_COMMIT_MESSAGE
instead of git show -s HEAD
Source: travis-ci/travis-build#936
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
Why did I created this gist? See travis-ci/travis-ci#5032
Results:
[skip travis]
in the commit message, "OK, I should not see this" is displayed: https://travis-ci.org/alexislefebvre/AsyncTweetsBundle/builds/193214754[skip travis]
in the commit message, "OK, I should not see this" is not displayed: https://travis-ci.org/alexislefebvre/AsyncTweetsBundle/builds/193215031Ways to improve this:
[skip travis]
or[travis skip]
, for people who forget the order of wordsgit 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