Skip to content

Commit

Permalink
Fix #1426 ALLOWED_BRANCH_NAME_CHARS in auto issue branch creation
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsimpson committed Dec 28, 2024
1 parent 79b3756 commit 2835ce2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/git-auto-issue-branch-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ jobs:
tr -cd '[:alnum:]- ' | \
# Convert spaces to hyphens '-'
tr ' ' '-' | \
# Remove double hyphens
sed 's/--/-/' | \
# Ensure lowercase branch name
tr '[:upper:]' '[:lower:]' | \
# Limit branch name to 60 characters
cut -c -60` >> $GITHUB_ENV
ALLOWED_BRANCH_NAME_CHARS='[^a-zA-Z0-9-]'
# Loop through each character in the branch name, replacing any not allowed characer with a hyphen '-'
while [[ $ISSUE_BRANCH_NAME =~ $ALLOWED_BRANCH_NAME_CHARS ]]; do
ISSUE_BRANCH_NAME=`echo $ISSUE_BRANCH_NAME | sed -r "s/($ALLOWED_BRANCH_NAME_CHARS)/-/g" | sed 's/--/-/'`
done
echo $ISSUE_BRANCH_NAME >> $GITHUB_ENV
- name: Create new branch
run: |
echo "The issue branch name is ${{ env.ISSUE_BRANCH_NAME}} "
Expand Down

0 comments on commit 2835ce2

Please sign in to comment.