Skip to content

Commit bd96f4c

Browse files
committed
feat: add branch protection workflow for main branch
1 parent 208b6c7 commit bd96f4c

1 file changed

Lines changed: 0 additions & 72 deletions

File tree

.github/workflows/protect_main.yml

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -78,75 +78,3 @@ jobs:
7878
echo " Base : ${{ github.event.pull_request.base.ref }}"
7979
echo " Head : ${{ github.event.pull_request.head.ref }}"
8080
81-
# ──────────────────────────────────────────────────────────────
82-
# JOB 3: Enforce branch naming convention on PR
83-
# ──────────────────────────────────────────────────────────────
84-
branch-name-check:
85-
name: Enforce Branch Naming Convention
86-
runs-on: ubuntu-latest
87-
if: github.event_name == 'pull_request'
88-
steps:
89-
- name: Check branch name
90-
run: |
91-
BRANCH="${{ github.event.pull_request.head.ref }}"
92-
echo "Branch name: $BRANCH"
93-
94-
# Allowed patterns:
95-
# feature/* (new features)
96-
# fix/* (bug fixes)
97-
# hotfix/* (emergency production fixes)
98-
# chore/* (maintenance, deps, docs)
99-
# refactor/* (code improvements)
100-
# release/* (release candidates)
101-
if echo "$BRANCH" | grep -qE '^(feature|fix|hotfix|chore|refactor|release)/.+'; then
102-
echo "✅ Branch name '$BRANCH' follows naming convention"
103-
else
104-
echo "=========================================="
105-
echo "❌ Invalid branch name: '$BRANCH'"
106-
echo "=========================================="
107-
echo ""
108-
echo "Branch names must follow the pattern:"
109-
echo " feature/<description> — new functionality"
110-
echo " fix/<description> — bug fixes"
111-
echo " hotfix/<description> — emergency production fixes"
112-
echo " chore/<description> — maintenance tasks"
113-
echo " refactor/<description> — code improvements"
114-
echo " release/<version> — release candidates"
115-
echo ""
116-
echo "Examples:"
117-
echo " feature/add-xgboost-model"
118-
echo " fix/drift-psi-threshold"
119-
echo " chore/update-dependencies"
120-
echo "=========================================="
121-
exit 1
122-
fi
123-
124-
# ──────────────────────────────────────────────────────────────------
125-
# JOB 4: Verify PR has a meaningful description
126-
# ──────────────────────────────────────────────────────────────-------
127-
pr-description-check:
128-
name: PR Description Required
129-
runs-on: ubuntu-latest
130-
if: github.event_name == 'pull_request'
131-
steps:
132-
- name: Check PR body length
133-
run: |
134-
BODY_LENGTH=$(echo "${{ github.event.pull_request.body }}" | wc -c)
135-
echo "PR description length: $BODY_LENGTH characters"
136-
137-
if [ "$BODY_LENGTH" -lt 30 ]; then
138-
echo "=========================================="
139-
echo "❌ PR description is too short ($BODY_LENGTH chars)"
140-
echo "=========================================="
141-
echo ""
142-
echo "Please add a meaningful PR description that includes:"
143-
echo " - What changed and why"
144-
echo " - How to test the changes"
145-
echo " - Any breaking changes or deployment notes"
146-
echo "=========================================="
147-
exit 1
148-
else
149-
echo "✅ PR description looks good ($BODY_LENGTH chars)"
150-
fi
151-
152-

0 commit comments

Comments
 (0)