File tree Expand file tree Collapse file tree 3 files changed +63
-531
lines changed Expand file tree Collapse file tree 3 files changed +63
-531
lines changed Original file line number Diff line number Diff line change
1
+ const { execSync } = require ( 'child_process' ) ;
2
+
3
+ // Check if there are changes in the website directory
4
+ function hasWebsiteChanges ( ) {
5
+ try {
6
+ // Get the list of changed files in the current commit compared to the base branch
7
+ const baseBranch = process . env . BASE_BRANCH || 'main' ;
8
+ const changedFiles = execSync ( `git diff --name-only origin/${ baseBranch } ...HEAD` , { encoding : 'utf8' } ) ;
9
+
10
+ // Check if any of the changed files are in the website directory
11
+ const websiteChanges = changedFiles
12
+ . split ( '\n' )
13
+ . filter ( file => file . trim ( ) && file . startsWith ( 'apps/website/' ) ) ;
14
+
15
+ return websiteChanges . length > 0 ;
16
+ } catch ( error ) {
17
+ // If we can't determine changes, allow the build to proceed
18
+ console . log ( 'Could not determine changes, allowing build to proceed' ) ;
19
+ return true ;
20
+ }
21
+ }
22
+
23
+ // Ignore build if:
24
+ // 1. Branch is owned by renovate, OR
25
+ // 2. No changes in website directory
26
+ const shouldIgnore = process . env . BRANCH ?. includes ( 'renovate' ) || ! hasWebsiteChanges ( ) ;
27
+
28
+ process . exitCode = shouldIgnore ? 0 : 1 ;
29
+
30
+ if ( shouldIgnore ) {
31
+ console . log ( 'Build ignored: No relevant changes detected' ) ;
32
+ } else {
33
+ console . log ( 'Build proceeding: Website changes detected' ) ;
34
+ }
Original file line number Diff line number Diff line change
1
+ [build ]
2
+ ignore = ' node ignore_build.js'
You can’t perform that action at this time.
0 commit comments