Skip to content

docs(apps): update README.md #10

docs(apps): update README.md

docs(apps): update README.md #10

name: Check Branch Name
on:
pull_request:
branches:
- main # Enforce on PRs to main
jobs:
check_branch_name:
runs-on: ubuntu-latest
steps:
- name: Check if PR target branch is ok
run: |
branch_name=${GITHUB_HEAD_REF}
echo "PR branch name: $branch_name"
target_branch=${GITHUB_BASE_REF}
echo "Target branch: $target_branch"
prod_regex="^(release\/.+|hotfix\/.+|main)$"
main_regex="^(fix|perf|ci|feat|test|docs|chore|refactor|)\/.+$"
if [[ "$target_branch" == "main" ]]; then
echo "Checking if branch name is valid for $target_branch branch."
if [[ ! "$branch_name" =~ $main_regex ]]; then
echo "Branch name does not meet $target_branch branch requirements. Must start with 'bugfix/', 'feature/', 'integration/', 'test/', 'docs/', 'chore/', or 'refactor/'."
exit 1
fi
else
echo "Target branch is not 'main'. Skipping checks."
exit 1
fi
shell: bash