Skip to content

Commit ec4d38a

Browse files
add PR check of node modules
1 parent 256c63a commit ec4d38a

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

.github/workflows/lint-build-test.yml renamed to .github/workflows/pr-checks.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Lint, Build & Test"
1+
name: "PR checks"
22

33
on: [push, pull_request]
44

@@ -30,10 +30,38 @@ jobs:
3030
if [ ! -z "$(git status --porcelain)" ]; then
3131
# If we get a fail here then the PR needs attention
3232
>&2 echo "Failed: JavaScript files are not up to date. Run 'npm run-script build' to update"
33+
git status
3334
exit 1
3435
fi
3536
echo "Success: JavaScript files are up to date"
3637
38+
check-node-modules:
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- uses: actions/checkout@v1
43+
- name: Check node modules up to date
44+
run: |
45+
# Sanity check that repo is clean to start with
46+
if [ ! -z "$(git status --porcelain)" ]; then
47+
# If we get a fail here then this workflow needs attention...
48+
>&2 echo "Failed: Repo should be clean before testing!"
49+
exit 1
50+
fi
51+
52+
# Reinstall modules and then clean to remove absolute paths
53+
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
54+
npm ci
55+
npm run removeNPMAbsolutePaths
56+
# Check that repo is still clean
57+
if [ ! -z "$(git status --porcelain)" ]; then
58+
# If we get a fail here then the PR needs attention
59+
>&2 echo "Failed: node_modules are not up to date. Run 'npm ci' and 'npm run removeNPMAbsolutePaths' to update"
60+
git status
61+
exit 1
62+
fi
63+
echo "Success: node_modules are up to date"
64+
3765
npm-test:
3866
runs-on: ubuntu-latest
3967

0 commit comments

Comments
 (0)