Skip to content

Commit

Permalink
chore(ci): check on branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-vandaele committed Aug 13, 2024
1 parent 627c6d0 commit 6b1cdbb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/BRANCH_NAME_CHECK_ON_PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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

0 comments on commit 6b1cdbb

Please sign in to comment.