Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1426 ALLOWED_BRANCH_NAME_CHARS in auto issue branch creation #1427

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading