We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 922c8b2 commit bd21cc4Copy full SHA for bd21cc4
1 file changed
.github/workflows/validate_branch_names.yml
@@ -1,12 +1,19 @@
1
-name: Run on Branch Creation
+name: Validate branch names
2
3
on:
4
create
5
6
jobs:
7
- run-on-branch-create:
+ on-branch-create:
8
if: startsWith(github.ref, 'refs/heads/')
9
runs-on: ubuntu-latest
10
steps:
11
- - name: Announce branch creation
12
- run: echo "Branch '${{ github.ref_name }}' was created by ${{ github.actor }}"
+ - name: Validate name
+ 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