chore(ci): check on branch name #1
Workflow file for this run
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
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 |