DEV Community

Discussion on: Skip CI stages in Travis based on what files changed.

Collapse
 
march38 profile image
Marc
  1. TRAVIS_COMMIT_RANGE only lists the range of commits for the most recent push. This means that if a user incrementally updates a PR by pushing to the branch it's based on, the above won't give you the full list of files for the PR, just the most recent push. The third is actually the easiest to solve, so we'll cover that first.

As of July 2020 that is not true. I just tested this and for a Pull Request ${TRAVIS_COMMIT_RANGE/.../..} is strictly identical to ${TRAVIS_BRANCH}..HEAD no matter what you (force) push to your submitted branch and how. So it may be possible to simplify that particular if PR/then/else.

Also, you want to keep the triple dots ... in TRAVIS_COMMIT_RANGE for git diff, they're very important and very different from double dots. Replace them with double dots .. only for the git log command which is inconsistent with git diff, see explanation at github.com/travis-ci/travis-ci/iss...

PS: Travis documentation seems to fall very short here.