0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/.github/hooks/pre-push
Daniel Lockyer 56b407f1f4
Added pre-push hook to run unit tests on changed packages
fixes https://github.com/TryGhost/Toolbox/issues/532

- we should protect against failures entering `main` which could be
  avoided by running a quick unit test beforehand
- this reintroduces Lerna as it supports parallelisation and `--since`,
  to run linting and unit tests on packages that have changed since
  upstream
2023-03-23 11:27:43 +01:00

10 lines
320 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
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$GIT_BRANCH" = "main" ]; then
printf " Pushing to \033[0;42m$GIT_BRANCH\033[0m branch requires some checks in advance\n"
yarn lerna run --include-dependents --since ${GHOST_UPSTREAM:-origin}/$GIT_BRANCH test:unit
fi