Skip to content

Commit 83f8fd1

Browse files
authored
Create check-branch-name.yml
1 parent 495d854 commit 83f8fd1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Check branch name
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'master' # ignore the 'master' branch
7+
- 'main' # ignore the 'main' branch
8+
9+
jobs:
10+
check-branch-name:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 2 # this is important, as the default is to only fetch the most recent commit
17+
18+
- name: Check branch name
19+
run: |
20+
commit_message=$(git log --format=%B -n 1 ${{ github.sha }})
21+
if [[ "${commit_message}" != "Apply fixes from StyleCI" && ! "${{ github.ref_name }}" =~ ^[0-9]{4}- ]]; then
22+
echo "ERROR: Branch name '${{ github.ref_name }}' does not start with a valid issue number!"
23+
exit 1
24+
fi

0 commit comments

Comments
 (0)