diff --git a/netlify.toml b/netlify.toml index bfdf789d..efd9f2ab 100644 --- a/netlify.toml +++ b/netlify.toml @@ -13,3 +13,6 @@ # Works for both regular PRs and forked PRs ignore = "./netlify-ignore.sh" +[build.environment] + # Disable git submodules - they are not needed for the website build + GIT_SUBMODULES = "false" \ No newline at end of file diff --git a/website/netlify-ignore.sh b/website/netlify-ignore.sh index 7391cc54..e46099b4 100755 --- a/website/netlify-ignore.sh +++ b/website/netlify-ignore.sh @@ -3,30 +3,26 @@ # Based on official Netlify documentation: https://docs.netlify.com/configure-builds/ignore-builds/ # Exit code: 0 = skip build, 1 = proceed with build -# Base branch name (adjust if your default branch is named differently) +# This script runs from the base directory (website/) but needs to check +# changes relative to the repository root +REPO_ROOT=$(git rev-parse --show-toplevel) BASE_BRANCH="main" # First, try using Netlify's environment variables (works for regular PRs) if [ -n "$CACHED_COMMIT_REF" ] && [ -n "$COMMIT_REF" ]; then - if git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF -- 'website/' 2>/dev/null; then - # No changes in website/ directory - skip build + if git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF -- "$REPO_ROOT/website/" 2>/dev/null; then exit 0 else - # Changes detected in website/ - proceed with build exit 1 fi fi # For forked PRs or when env vars aren't available, fetch base branch and compare -# Fetch the latest commit on the base branch -git fetch origin $BASE_BRANCH:$BASE_BRANCH 2>/dev/null || true +git fetch origin $BASE_BRANCH 2>/dev/null || true # Check for changes in the website/ directory using three-dot syntax (merge base comparison) -# The three-dot syntax (BASE_BRANCH...HEAD) compares the merge base to HEAD -if git diff --quiet origin/$BASE_BRANCH...HEAD -- 'website/' 2>/dev/null; then - # No changes detected in website/ directory - skip build +if git diff --quiet origin/$BASE_BRANCH...HEAD -- "$REPO_ROOT/website/" 2>/dev/null; then exit 0 else - # Changes detected in website/ directory - proceed with build exit 1 fi \ No newline at end of file