mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-20 21:35:42 +02:00
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.
This commit is contained in:
parent
761eb9e5ef
commit
4e32f729c1
2 changed files with 8 additions and 0 deletions
|
@ -11,4 +11,6 @@ cache:
|
||||||
directories:
|
directories:
|
||||||
- "node_modules"
|
- "node_modules"
|
||||||
script:
|
script:
|
||||||
|
- ./checkgit.sh "Source files were modified before build; is yarn.lock out of sync with package.json?" || travis_terminate $?
|
||||||
- yarn grunt
|
- yarn grunt
|
||||||
|
- ./checkgit.sh "Source files were modified by the build" || travis_terminate $?
|
||||||
|
|
6
checkgit.sh
Executable file
6
checkgit.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
GIT_STATUS=$(git status --porcelain | wc -l )
|
||||||
|
if [[ GIT_STATUS -ne 0 ]]; then
|
||||||
|
echo "${1:-Source files were modified}"
|
||||||
|
git status
|
||||||
|
exit $GIT_STATUS
|
||||||
|
fi;
|
Loading…
Add table
Add a link
Reference in a new issue