mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Add source diff for CI
This commit is contained in:
parent
02294d7761
commit
9ecec7e290
29
webpack/source-diff.js
Normal file
29
webpack/source-diff.js
Normal file
@ -0,0 +1,29 @@
|
||||
const process = require('child_process')
|
||||
|
||||
const excludePatterns = [
|
||||
/^docs?\//,
|
||||
/^\.vscode\//,
|
||||
/^\.git/,
|
||||
/^builder\//,
|
||||
/^images\//,
|
||||
/^min\//,
|
||||
/^README\.md$/,
|
||||
/^CHANGELOG\.md$/,
|
||||
/^CODE_OF_CONDUCT\.md$/,
|
||||
/^LICENCE$/,
|
||||
]
|
||||
|
||||
const isSourceChanged = () => {
|
||||
const lastDiff = process
|
||||
.execSync('git diff --name-only HEAD^')
|
||||
.toString()
|
||||
.trim()
|
||||
.split('\n')
|
||||
|
||||
const isAllExcluded = lastDiff.every(path => excludePatterns.some(p => p.test(path)))
|
||||
return !isAllExcluded
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isSourceChanged,
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user