From cf89e08c77ae69446239c39d8df5048c9eaa6476 Mon Sep 17 00:00:00 2001 From: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com> Date: Wed, 5 Mar 2025 22:40:14 +0100 Subject: [PATCH 1/4] ignore in tests --- src/tools/scripts/run_and_test_website.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/scripts/run_and_test_website.sh b/src/tools/scripts/run_and_test_website.sh index bedd2ea6caf..3821714f20f 100755 --- a/src/tools/scripts/run_and_test_website.sh +++ b/src/tools/scripts/run_and_test_website.sh @@ -87,7 +87,7 @@ npm run test # If being run in GitHub actions then generating the website should not # change any Git-tracked files. If it does then it suggests something's # wrong. Exit -if [ "${GITHUB_ACTIONS}" ] && [ -n "$(git status --porcelain)" ]; then +if [ "${GITHUB_ACTIONS}" ] && [ -n "$(git update-index --assume-unchanged package-lock.json && git status --porcelain)" ]; then echo "Generating the website produced a different file than is in the branch" git status exit 1 From c7601feaab4a9fdb289ac2b9d63df9d359ebd9be Mon Sep 17 00:00:00 2001 From: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com> Date: Wed, 5 Mar 2025 23:59:57 +0100 Subject: [PATCH 2/4] must use package-lock --- src/tools/scripts/run_and_test_website.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/scripts/run_and_test_website.sh b/src/tools/scripts/run_and_test_website.sh index 3821714f20f..34e79b0a938 100755 --- a/src/tools/scripts/run_and_test_website.sh +++ b/src/tools/scripts/run_and_test_website.sh @@ -73,7 +73,7 @@ sleep 2 pgrep -if "python main.py" echo "Installing node modules" -npm install +npm ci echo "Building website" npm run generate @@ -87,7 +87,7 @@ npm run test # If being run in GitHub actions then generating the website should not # change any Git-tracked files. If it does then it suggests something's # wrong. Exit -if [ "${GITHUB_ACTIONS}" ] && [ -n "$(git update-index --assume-unchanged package-lock.json && git status --porcelain)" ]; then +if [ "${GITHUB_ACTIONS}" ] && [ -n "$(git status --porcelain)" ]; then echo "Generating the website produced a different file than is in the branch" git status exit 1 From b3603465a74317f35a18f2fe1e3d66323688e884 Mon Sep 17 00:00:00 2001 From: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com> Date: Thu, 6 Mar 2025 00:21:14 +0100 Subject: [PATCH 3/4] optional --- src/tools/scripts/run_and_test_website.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/scripts/run_and_test_website.sh b/src/tools/scripts/run_and_test_website.sh index 34e79b0a938..f433cdce658 100755 --- a/src/tools/scripts/run_and_test_website.sh +++ b/src/tools/scripts/run_and_test_website.sh @@ -73,7 +73,7 @@ sleep 2 pgrep -if "python main.py" echo "Installing node modules" -npm ci +[ "$GITHUB_ACTIONS" ] && npm ci || npm install echo "Building website" npm run generate From 8738e2eaae14da6a12e57b26acdef22c0101687a Mon Sep 17 00:00:00 2001 From: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com> Date: Thu, 6 Mar 2025 00:25:48 +0100 Subject: [PATCH 4/4] lint --- src/tools/scripts/run_and_test_website.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tools/scripts/run_and_test_website.sh b/src/tools/scripts/run_and_test_website.sh index f433cdce658..83e11fa5901 100755 --- a/src/tools/scripts/run_and_test_website.sh +++ b/src/tools/scripts/run_and_test_website.sh @@ -73,7 +73,11 @@ sleep 2 pgrep -if "python main.py" echo "Installing node modules" -[ "$GITHUB_ACTIONS" ] && npm ci || npm install +if [ "$GITHUB_ACTIONS" ]; then + npm ci +else + npm install +fi echo "Building website" npm run generate