Skip to content

Commit bd21cc4

Browse files
committed
add
1 parent 922c8b2 commit bd21cc4

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
name: Run on Branch Creation
1+
name: Validate branch names
22

33
on:
44
create
55

66
jobs:
7-
run-on-branch-create:
7+
on-branch-create:
88
if: startsWith(github.ref, 'refs/heads/')
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: Announce branch creation
12-
run: echo "Branch '${{ github.ref_name }}' was created by ${{ github.actor }}"
11+
- name: Validate name
12+
run: |
13+
INVALID_CHARS='[<>:"/\\|?*]'
14+
if [[ "${{ github.ref_name }}" =~ $INVALID_CHARS ]]; then
15+
echo "Error: Branch name '${{ github.ref_name }}' created by ${{ github.actor }} contains invalid characters."
16+
exit 1
17+
else
18+
echo "Branch name '${{ github.ref_name }}' is valid."
19+
fi

0 commit comments

Comments
 (0)