Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions apps/website/ignore_build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { execSync } = require('child_process');

// Check if there are changes in the website directory
function hasWebsiteChanges() {
try {
// Get the list of changed files in the current commit compared to the base branch
const baseBranch = process.env.BASE_BRANCH || 'main';
const changedFiles = execSync(`git diff --name-only origin/${baseBranch}...HEAD`, { encoding: 'utf8' });

// Check if any of the changed files are in the website directory
const websiteChanges = changedFiles
.split('\n')
.filter(file => file.trim() && file.startsWith('apps/website/'));

return websiteChanges.length > 0;
} catch (error) {
// If we can't determine changes, allow the build to proceed
console.log('Could not determine changes, allowing build to proceed');
return true;
}
}

// Ignore build if:
// 1. Branch is owned by renovate, OR
// 2. No changes in website directory
const shouldIgnore = process.env.BRANCH?.includes('renovate') || !hasWebsiteChanges();

process.exitCode = shouldIgnore ? 0 : 1;

if (shouldIgnore) {
console.log('Build ignored: No relevant changes detected');
} else {
console.log('Build proceeding: Website changes detected');
}
2 changes: 2 additions & 0 deletions apps/website/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
ignore = 'node ignore_build.js'
Loading