summaryrefslogtreecommitdiff
path: root/format-code.sh
diff options
context:
space:
mode:
Diffstat (limited to 'format-code.sh')
-rwxr-xr-xformat-code.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/format-code.sh b/format-code.sh
index b490dd2a..9649a403 100755
--- a/format-code.sh
+++ b/format-code.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
# Run GUI Linting and Formatting as part of the CI Build process
#
# This is a short term solution. The long term solution to will be to
@@ -6,6 +7,13 @@
set -e
+# When called from openbmc-build-scripts, the `pwd` could be anywhere, but
+# the root of the repo is passed in the first argument. Switch to the repo
+# root so npm/git run in the right place.
+if [ -n "$1" ]; then
+ cd "$1"
+fi
+
npm ci
npm run lint
-git --no-pager diff --exit-code \ No newline at end of file
+git --no-pager diff --exit-code