Skip to content

Commit 74c49df

Browse files
authored
(#8667) - test-webpack: fail if git working tree is dirty
Co-authored-by: alxndrsn <alxndrsn>
1 parent ba74ebe commit 74c49df

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ jobs:
266266
- name: First retry
267267
id: retry
268268
if: steps.test.outcome == 'failure'
269-
run: ${{ matrix.cmd }}
269+
run: git reset --hard && ${{ matrix.cmd }}
270270
continue-on-error: true
271271
- name: Second retry
272272
if: steps.retry.outcome == 'failure'
273-
run: ${{ matrix.cmd }}
273+
run: git reset --hard && ${{ matrix.cmd }}

bin/test-webpack.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@
66
# Webpack and Browserify to justify it.
77
#
88

9+
# If this script is run _after_ bin/update-package-json-for-publish.js is run,
10+
# `npm run build` may fail with:
11+
#
12+
# > Error: 'default' is not exported by node_modules/inherits/inherits.js
13+
#
14+
# To avoid this, fail if this script is run in a non-clean git repo:
15+
git_diff="$(git diff -- package.json packages/node_modules/*/package.json)"
16+
if [[ "$git_diff" != "" ]]; then
17+
git status --untracked-files=no -- package.json packages/node_modules/*/package.json
18+
echo "!!!"
19+
echo "!!! Your git working directory has changes to package.json file(s) !!!"
20+
echo "!!! Please revert/stage/commit changes, and re-run the command !!!"
21+
echo "!!!"
22+
exit 1
23+
fi
24+
925
npm run build
1026
npm i webpack@5.66.0 webpack-cli@4.9.2 # do this on-demand to avoid slow installs
1127
node bin/update-package-json-for-publish.js

0 commit comments

Comments
 (0)