-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Check Branch and PR Naming Conventions | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
types: [opened, edited, reopened] | ||
|
||
jobs: | ||
check-naming: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check branch and PR title naming conventions | ||
run: | | ||
branch_name="${{ github.event.pull_request.head.ref }}" | ||
pr_title="${{ github.event.pull_request.title }}" | ||
echo "Checking branch name and PR title..." | ||
# Check for Release branches | ||
if [[ "$branch_name" =~ ^release- ]]; then | ||
if [[ ! "$pr_title" =~ ^Release: ]]; then | ||
echo "Error: For 'release-*' branches, PR title must start with 'Release:'." | ||
exit 1 | ||
fi | ||
# Check for Hotfix branches | ||
elif [[ "$branch_name" =~ ^hotfix- ]]; then | ||
if [[ ! "$pr_title" =~ ^Hotfix: ]]; then | ||
echo "Error: For 'hotfix-*' branches, PR title must start with 'Hotfix:'." | ||
exit 1 | ||
fi | ||
else | ||
echo "Error: Branch must start with 'release-' or 'hotfix-'." | ||
exit 1 | ||
fi | ||
echo "Branch and PR title naming conventions are correct." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters