Ghost/.github/hooks/pre-push
Daniel Lockyer 846a9cdafc
Fixed pre-push hook running when pushing to fork
- this prevents the unit tests running if you're pushing to a fork,
  which we don't care about because it doesn't block the upstream `main`
2023-03-23 17:31:06 +01:00

14 lines
422 B
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
[ -n "$CI" ] && exit 0
UPSTREAM=${GHOST_UPSTREAM:-origin}
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
# $1 is the name of the remote to which the push is being done
if [ "$1" = "$UPSTREAM" ] && [ "$GIT_BRANCH" = "main" ]; then
printf " Pushing to \033[0;32m$GIT_BRANCH\033[0m branch requires some checks in advance\n"
yarn lerna run --include-dependents --since $1/$GIT_BRANCH test:unit
fi