Skip to content

chore(ci): check on branch name #1

chore(ci): check on branch name

chore(ci): check on branch name #1

on:
pull_request:
branches:
- main
- master
jobs:
check-branch-name:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
id: extract_branch
run: echo "::set-output name=branch::${GITHUB_HEAD_REF}"
- name: Check if branch name follows conventional commit regex
run: |
BRANCH_REGEX='^(feat|fix|docs|style|refactor|perf|test|chore)\(?.+\)?: .+$'
if [[ "${{ steps.extract_branch.outputs.branch }}" =~ $BRANCH_REGEX ]]; then
echo "Branch name follows the conventional commit format."
else
echo "Branch name does not follow the conventional commit format."
exit 1
fi