Skip travis build if an unimportant file changed

I run my unit tests on every commit. However, sometimes all I want to do is edit the README. Is there a way to skip Travis builds if all the changes are restricted to a whitelisted set of files?

Is this possible?

There’s not really a way to directly make Travis dynamically determine, based only on the type of file that has been changed, if it should or shouldn’t run a build via bash.

However, Travis will ignore any commit with [ci-skip] or [skip-ci] in the commit message, so you can make sure you add these.

Perhaps you could use git hook or something similar to append [ci-skip] to the commit message when only .md files have been modified. (For example).

In the git hook, you could detect this scenario with a command like `git diff --exit-code --name-only – (excluding *md).

git diff --name-only (no stash) 
README.md
git diff --exit-code --name-only -- . ':(exclude)*.md' (or any other files)
echo $? (echo print) 
0 (exit code)

Make sure there’s nothing in your stash, and if there is remove it via git stash pop. Hope this helps.

as always @Montana fixing my problems constantly, as im constantly using Travis! best support ive seen… thank you

Hey @SolarUltima,

Of course no problem! It’s what I do.

Imprint