Skip to content

feat(git): configure Git hooks and enhance project setup #2

feat(git): configure Git hooks and enhance project setup

feat(git): configure Git hooks and enhance project setup #2

Workflow file for this run

name: Branch Name Check
on:
push:
branches-ignore:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
check-branch-name:
runs-on: ubuntu-latest
steps:
- name: Check branch name
run: |
BRANCH=${GITHUB_REF#refs/heads/}
if [[ ! $BRANCH =~ ^[a-zA-Z0-9]+/[a-zA-Z0-9-]+$ ]]; then
echo "🚫 Branch name validation failed"
echo "Branch: $BRANCH"
echo "Required format: username/feature-name"
echo "Examples:"
echo "βœ… john/add-footer"
echo "βœ… jane/fix-auth"
echo "❌ main"
echo "❌ feature-branch"
echo "❌ fix_bug"
exit 1
fi
echo "βœ… Branch name follows convention: $BRANCH"
validate-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check commit message
run: |
git log -1 --pretty=format:"%s" | npx --no -- commitlint
if [ $? -ne 0 ]; then
echo "🚫 Commit message must follow conventional commits"
echo "Examples:"
echo "βœ… feat: add new button component"
echo "βœ… fix: resolve auth redirect issue"
echo "βœ… docs: update README"
exit 1
fi