gh-100072: only trigger netlify builds for doc changes by sobolevn · Pull Request #100074 · python/cpython

With local testing, yes.

With Netlify, no...

hugovk@abbc30d shows "Deploy Preview canceled." for both PRs...

hugovk#34 with no docs change:

7:35:00 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'git diff --name-only | grep -q '^Doc/' && exit 1 || exit 0'
7:35:01 PM: User-specified ignore command returned exit code 0. Returning early from build.
7:35:01 PM: Creating deploy upload records
7:35:01 PM: Failed during stage 'checking build content for changes': Canceled build due to no content change
7:35:01 PM: Finished processing build request in 13.44133397s

hugovk#35 with docs change:

7:35:15 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'git diff --name-only | grep -q '^Doc/' && exit 1 || exit 0'
7:35:16 PM: User-specified ignore command returned exit code 0. Returning early from build.
7:35:16 PM: Creating deploy upload records
7:35:17 PM: Failed during stage 'checking build content for changes': Canceled build due to no content change
7:35:17 PM: Finished processing build request in 12.800699818s

Rewinding and looking at the logs for #100074 (comment):

hugovk#34 without docs change:

4:57:39 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF Doc/ netlify.toml'
4:57:40 PM: fatal: ambiguous argument 'Doc/': unknown revision or path not in the working tree.
4:57:40 PM: Use '--' to separate paths from revisions, like this:
4:57:40 PM: 'git <command> [<revision>...] -- [<file>...]'

hugovk#35 with docs change:

4:56:02 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF Doc/ netlify.toml'
4:56:02 PM: fatal: ambiguous argument 'Doc/': unknown revision or path not in the working tree.
4:56:02 PM: Use '--' to separate paths from revisions, like this:
4:56:02 PM: 'git <command> [<revision>...] -- [<file>...]'

So we've already set base = "Doc/", where:

The base directory setting prompts our buildbots to change to the specified directory to detect dependencies and perform caching during the build process. It’s useful for building from a monorepo or subdirectory.

So let's try git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../netlify.toml: hugovk@1810da0

I also cleared the deploy caches, in case the rebase/force pushes

hugovk#34 without docs change - no Netlify build! ✅:

8:13:58 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../netlify.toml'
8:13:58 PM: User-specified ignore command returned exit code 0. Returning early from build.
8:13:58 PM: Creating deploy upload records
8:13:58 PM: Failed during stage 'checking build content for changes': Canceled build due to no content change
8:13:59 PM: Finished processing build request in 37.864234653s

hugovk#35 with docs change - has Netlify build! ✅:

8:11:51 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../netlify.toml'
8:11:51 PM: Section completed: initializing
8:11:51 PM: Starting build script
...

So let's try this!