Skip to content

Commit 4e32f72

Browse files
Check that there are no source file changes before building
If dependencies are changed (in package.json) without updating the yarn.lock file, or if any other part of the build process starts producing unignored files, the CI build will fail, so that the problem can be corrected before the PR is merged.
1 parent 761eb9e commit 4e32f72

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ cache:
1111
directories:
1212
- "node_modules"
1313
script:
14+
- ./checkgit.sh "Source files were modified before build; is yarn.lock out of sync with package.json?" || travis_terminate $?
1415
- yarn grunt
16+
- ./checkgit.sh "Source files were modified by the build" || travis_terminate $?

checkgit.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
GIT_STATUS=$(git status --porcelain | wc -l )
2+
if [[ GIT_STATUS -ne 0 ]]; then
3+
echo "${1:-Source files were modified}"
4+
git status
5+
exit $GIT_STATUS
6+
fi;

0 commit comments

Comments
 (0)