name: Branch Push Naming Convention Check on: push: branches-ignore: - master jobs: validate-branch-push: runs-on: ubuntu-latest steps: - name: Check branch name env: BRANCH_NAME: ${{ github.ref_name }} run: | branch_name="$BRANCH_NAME" if [[ "$branch_name" == "master" ]]; then echo "Branch is master, skipping check." exit 0 fi if [[ "$branch_name" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "Branch name '$branch_name' follows the release naming convention." exit 0 fi if ! [[ "$branch_name" =~ ^(feature|bugfix|hotfix|documentation|refactor|other)/ ]]; then echo "Branch name '$branch_name' does not follow the naming convention." echo "It should start with one of: feature/, bugfix/, hotfix/, documentation/, refactor/, other/, or be a release/x.y.z branch." echo "Example: feature/my-feature-name, bugfix/fix-issue-123, or release/1.2.3" exit 1 fi