mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Removed pre-commit linting on non-main
branches
- our use-case for this is to ensure that people don't push to `main` without running linting, as this can block CI from passing until the linting issue is resolved - however, it can become annoying to run linting on non-main branches, especially when you just want to WIP some changes without caring for linting - generally speaking, anyone who creates commits on a non-main branch is going to open them as a PR, so linting is run anyway - this commit get the branch name and only runs linting if we're on `main`
This commit is contained in:
parent
3da7040e32
commit
077ff89960
1 changed files with 8 additions and 5 deletions
13
.github/hooks/pre-commit
vendored
13
.github/hooks/pre-commit
vendored
|
@ -3,12 +3,15 @@
|
||||||
|
|
||||||
[ -n "$CI" ] && exit 0
|
[ -n "$CI" ] && exit 0
|
||||||
|
|
||||||
yarn lint-staged --relative
|
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
lintStatus=$?
|
if [ "$GIT_BRANCH" = "main" ]; then
|
||||||
|
yarn lint-staged --relative
|
||||||
|
lintStatus=$?
|
||||||
|
|
||||||
if [ $lintStatus -ne 0 ]; then
|
if [ $lintStatus -ne 0 ]; then
|
||||||
echo "❌ Linting failed"
|
echo "❌ Linting failed"
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
green='\033[0;32m'
|
green='\033[0;32m'
|
||||||
|
|
Loading…
Reference in a new issue