Avoid running jobs if PR is documentation-related

Hi,

I’m looking for a way not to launch jobs if the PR is documentation only.

After looking at some threads, we’ve recently set the following in place :

before_install:
  - |
    if ! git diff --name-only ${TRAVIS_COMMIT_RANGE} | grep -qvE '(\.md)$|^(Copyright)$|^(docs/)'
    then
      echo "Skipping CI build since we have docs-only changes for ${TRAVIS_COMMIT_RANGE} :"
      git diff --name-only ${TRAVIS_COMMIT_RANGE}
      exit
    fi

However using this approach:

  • jobs are still triggered
  • they still take some time (APT update )
  • git checkout is done after update and then the check from above

Does anyone have a better strategy? Either reducing the jobs time or even better not launching them?

Here is our .travis.yml

Thank you.

Consider upvoting the below FR – it would allow you to quit the job before the installation logic fires.

Possible duplicate of

Upvoted, thanks for your input.