rusackas opened a new pull request, #40590:
URL: https://github.com/apache/superset/pull/40590
### SUMMARY
The docs Netlify build already has a path-based `ignore` command, but it
only worked for *some* builds. It diffed against `$CACHED_COMMIT_REF` — the
last **deployed** commit of that preview context — and on a PR's **first**
build that variable is empty. With it empty, `git diff --quiet "" $COMMIT_REF`
errors, and Netlify treats a non-zero exit from the ignore command as "build" —
so **every PR built a full docs preview at least once, even with zero docs
changes** (e.g. #40587, a backend-only change, deployed a docs preview).
This change keeps the cheap incremental diff when `$CACHED_COMMIT_REF` is
available (subsequent PR builds + the master production deploy), and **falls
back to diffing the branch against its merge-base with `master`** when it's
empty — so non-docs PRs are skipped from the very first build:
```sh
if [ -n "$CACHED_COMMIT_REF" ]; then
git diff --quiet "$CACHED_COMMIT_REF" "$COMMIT_REF" -- . ../README.md
else
git fetch origin master --depth=100 >/dev/null 2>&1
git diff --quiet "$(git merge-base origin/master "$COMMIT_REF" 2>/dev/null
|| echo origin/master)" "$COMMIT_REF" -- . ../README.md
fi
```
Any failure (fetch/merge-base errors, shallow-clone edge cases) exits
non-zero, preserving the existing safe "build when unsure" behavior — it can
never *skip* a build it should have run.
### Notes
- The `master` production deploy is unaffected: it has a populated
`$CACHED_COMMIT_REF`, so it stays on the incremental path and still rebuilds
whenever a docs change lands on master.
- This PR touches `docs/netlify.toml`, so its **own** preview will
(correctly) build — a live confirmation that docs-touching PRs still deploy.
- Validated: the file parses as TOML and the `ignore` command is valid `bash
-n`.
### TESTING INSTRUCTIONS
N/A — CI config. Behavior is observable on this PR (docs preview builds,
since it edits docs/) and on the next non-docs PR (no preview build).
### ADDITIONAL INFORMATION
- [ ] Has associated issue: n/a
- [ ] Required feature flags: n/a
- [ ] Changes UI: No
- [ ] Includes DB Migration: No
- [ ] Introduces new feature or API: No
- [ ] Removes existing feature or API: No
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]