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
if [[ ! -z "$NO_HOOK" ]]
then
if [ -n "$NO_HOOK" ]; then
exit 0
fi
@ -9,4 +8,4 @@ fi
. "$(dirname "$0")/required-apps"
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
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."
exit 1
fi
if [[ ! -x "$(command -v pnpm)" ]]; then
PMGR=yarn
if [[ ! -x "$(command -v yarn)" ]]; then
PMGR=npm
if [[ ! -x "$(command -v npm)" ]]; then
if [ ! -x "$(command -v pnpm)" ]; then
export PMGR=yarn
if [ ! -x "$(command -v yarn)" ]; then
export PMGR=npm
if [ ! -x "$(command -v npm)" ]; then
echo "You must install a node package manager."
exit 1
fi