Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

# ─── Configuration ────────────────────────────────────────────────────────────

# Branches exempt from naming checks (space-separated)
PROTECTED_BRANCHES="development production"

# Allowed prefixes for feature branches (space-separated)
ALLOWED_PREFIXES="feat content fix chore"

# ──────────────────────────────────────────────────────────────────────────────

branch=$(git symbolic-ref HEAD 2>/dev/null | sed 's|refs/heads/||')

# Allow protected branches
for protected in $PROTECTED_BRANCHES; do
[ "$branch" = "$protected" ] && exit 0
done

# Build regex pattern from allowed prefixes
pattern=$(echo "$ALLOWED_PREFIXES" | sed 's/ /|/g')

if ! echo "$branch" | grep -qE "^($pattern)/.+"; then
echo "ERROR: Branch name '$branch' does not follow the naming convention."
echo " Allowed prefixes: $(echo "$ALLOWED_PREFIXES" | sed 's/ /, /g')"
echo " Example: feat/<description>, fix/<description>"
echo ""
echo " To rename the current branch, run:"
echo " git branch -m <new-name>"
exit 1
fi

exit 0
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ All PRs to `development` and `production` run:

- Default branch: `development`
- Production branch: `production` (only merged from `development`)
- Branch naming: `feature/description` or `content/description` from
- Branch naming: `feat/description`, `content/description`, `fix/description`, or `chore/description` from
`development`
- PRs require review from `@Krzemien97` or `@bjsowa` (see `CODEOWNERS`)

Expand Down
Loading
Loading