mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(ci): analyze commits should scan complete commit range.
Closes #216
This commit is contained in:
committed by
Jeremy Elbourn
parent
fb6e580eab
commit
7fa7fa7bcc
+1
-1
@@ -67,7 +67,7 @@ before_script:
|
||||
- "sh -e /etc/init.d/xvfb start"
|
||||
- mkdir -p $LOGS_DIR
|
||||
- npm run tslint
|
||||
- "node ./scripts/ci/analyze-commits.js"
|
||||
- "node ./scripts/ci/forbidden-identifiers.js"
|
||||
|
||||
|
||||
script:
|
||||
|
||||
@@ -16,15 +16,18 @@ var blocked_statements = [
|
||||
];
|
||||
|
||||
var blockedRegex = new RegExp('\\+.*(' + blocked_statements.join('|') + ').*$', 'mg');
|
||||
var commit_range = process.env.TRAVIS_COMMIT_RANGE || 'HEAD~1';
|
||||
|
||||
var diff = child_process.execSync('git diff --unified=0 HEAD~1 ./src ./e2e').toString();
|
||||
var isInvalid = blockedRegex.test(diff);
|
||||
var diff = child_process.execSync(`git diff --unified=0 ${commit_range} ./src ./e2e`).toString();
|
||||
|
||||
if (blockedRegex.test(diff)) {
|
||||
|
||||
if (isInvalid) {
|
||||
console.warn('Warning: You are using a statement in your commit, which is not allowed.\n' +
|
||||
'Blocked Statements are: ' + blocked_statements.join(', ') + '\n' +
|
||||
'Please remove them, and the CI will continue.');
|
||||
|
||||
process.exit(1);
|
||||
|
||||
} else {
|
||||
console.log('Info: The commits have been analyzed and are valid!');
|
||||
}
|
||||
Reference in New Issue
Block a user