ci: fix pre-commit scripts compatibility with posix shells (#4243)

Co-authored-by: James Elliott <james-d-elliott@users.noreply.github.com>
pull/4335/head
Stephen Kent 2022-11-05 14:10:13 -07:00 committed by GitHub
parent 606875ea39
commit 548bdce8ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 11 deletions

5
.github/pre-commit vendored
View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
if [[ ! -z "$NO_HOOK" ]] if [ -n "$NO_HOOK" ]; then
then
exit 0 exit 0
fi fi
@ -9,4 +8,4 @@ fi
. "$(dirname "$0")/required-apps" . "$(dirname "$0")/required-apps"
golangci-lint run -v --fix && \ golangci-lint run -v --fix && \
cd web && ${PMGR} lint cd web && "${PMGR}" lint

14
.github/required-apps vendored
View File

@ -1,17 +1,17 @@
#!/bin/sh #!/bin/sh
PMGR=pnpm export PMGR=pnpm
if [[ ! -x "$(command -v golangci-lint)" ]]; then if [ ! -x "$(command -v golangci-lint)" ]; then
echo "You must install golangci-lint." echo "You must install golangci-lint."
exit 1 exit 1
fi fi
if [[ ! -x "$(command -v pnpm)" ]]; then if [ ! -x "$(command -v pnpm)" ]; then
PMGR=yarn export PMGR=yarn
if [[ ! -x "$(command -v yarn)" ]]; then if [ ! -x "$(command -v yarn)" ]; then
PMGR=npm export PMGR=npm
if [[ ! -x "$(command -v npm)" ]]; then if [ ! -x "$(command -v npm)" ]; then
echo "You must install a node package manager." echo "You must install a node package manager."
exit 1 exit 1
fi fi