Skip to content

Commit 74509a7

Browse files
authored
Merge pull request #12 from prgrms-web-devcourse-final-project/chore/git
chore[git]: create-branch 수정
2 parents 048f330 + eaf4a57 commit 74509a7

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/create-branch.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,23 @@ jobs:
3737
- name: Create branch
3838
run: |
3939
ISSUE_NUMBER=${{ github.event.issue.number }}
40-
ISSUE_TITLE=${{ github.event.issue.title }}
41-
SANITIZED_TITLE=$(echo "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-')
42-
43-
BRANCH_NAME="${{ steps.prefix.outputs.prefix }}/${ISSUE_NUMBER}-${SANITIZED_TITLE}"
40+
ISSUE_TITLE="${{ github.event.issue.title }}"
41+
42+
# 영어/숫자만 남기고, 나머지는 - 로 치환
43+
SANITIZED_TITLE=$(echo "$ISSUE_TITLE" | iconv -t ascii//translit | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-')
44+
45+
if [ -n "${{ steps.custom.outputs.custom_name }}" ]; then
46+
BRANCH_NAME="${{ steps.prefix.outputs.prefix }}/${ISSUE_NUMBER}-${{ steps.custom.outputs.custom_name }}"
47+
else
48+
BRANCH_NAME="${{ steps.prefix.outputs.prefix }}/${ISSUE_NUMBER}-${SANITIZED_TITLE}"
49+
fi
50+
4451
echo "Creating branch: $BRANCH_NAME"
45-
52+
4653
git config user.name "github-actions[bot]"
4754
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
48-
49-
git fetch ${{ github.event.repository.default_branch }}
50-
git checkout -b "$BRANCH_NAME" origin/main
55+
56+
DEFAULT_BRANCH=${{ github.event.repository.default_branch }}
57+
git fetch origin $DEFAULT_BRANCH
58+
git checkout -b "$BRANCH_NAME" origin/$DEFAULT_BRANCH
5159
git push origin "$BRANCH_NAME"

0 commit comments

Comments
 (0)