-
Notifications
You must be signed in to change notification settings - Fork 0
/
ignore-builds-master.mjs
69 lines (57 loc) · 1.86 KB
/
ignore-builds-master.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { execSync } from 'child_process'
console.info('Running ignore script')
const cachedCommitRef =
process.env.CACHED_COMMIT_REF || 'd06423d365fa9cf3ef99a8653abbf1a83fe7d3bb'
const commitRef = process.env.COMMIT_REF || 'HEAD'
const changesList = execSync(
`git diff --name-only ${cachedCommitRef} ${commitRef}`
).toString()
console.info('Changes list:')
console.info(changesList)
class Changed {
constructor({ src = false, deps = false }) {
this.src = src
this.deps = deps
}
get any() {
return this.src || this.deps
}
}
// Packages
const espritDesignChange = new Changed({
src: changesList.includes('packages/esprit-design'),
deps: false
})
const nuxtDesignSystemChange = new Changed({
src: changesList.includes('packages/nuxt-design-system'),
deps: espritDesignChange.any
})
const nuxtContentMermaidChange = new Changed({
src: changesList.includes('packages/nuxt-content-mermaid'),
deps: false
})
const d0xigenChange = new Changed({
src: changesList.includes('packages/d0xigen'),
deps: nuxtDesignSystemChange.any || nuxtContentMermaidChange.any
})
// Apps
const d0richMeChange = new Changed({
src: changesList.includes('apps/d0rich.me'),
deps: nuxtDesignSystemChange.any || nuxtContentMermaidChange.any
})
const d0xigenD0richMeChange = new Changed({
src: changesList.includes('apps/d0xigen.d0rich.me'),
deps: d0xigenChange.any
})
const designD0richMeChange = new Changed({
src: changesList.includes('apps/design.d0rich.me'),
deps: nuxtDesignSystemChange.any
})
const dogD0richMeChange = new Changed({
src: changesList.includes('apps/dog.d0rich.me'),
deps: d0xigenChange.any
})
export const ignoreD0richMeBuild = !d0richMeChange.any
export const ignoreD0xigenD0richMeBuild = !d0xigenD0richMeChange.any
export const ignoreDesignD0richMeBuild = !designD0richMeChange.any
export const ignoreDogD0richMeBuild = !dogD0richMeChange.any