Skip to content

[feat] 이슈 제목 #128

[feat] 이슈 제목

[feat] 이슈 제목 #128

name: Create Jira Issue and Sync with GitHub
on:
issues:
types: [opened]
push:
branches:
- 'feat/*'
- 'fix/*'
- 'docs/*'
- 'setting/*'
- 'add/*'
- 'refactor/*'
- 'chore/*'
jobs:
create_jira_issue:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: 'suyeon' # suyeon 브랜치를 체크아웃
- name: Setup Git Config
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Create branch for the issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ISSUE_NUMBER=${{ github.event.issue.number }}
ISSUE_TITLE="${{ github.event.issue.title }}"
PREFIX=$(echo "$ISSUE_TITLE" | grep -oE '^(feat|fix|docs|setting|add|refactor|chore)')
if [ -z "$PREFIX" ]; then PREFIX="feature"; fi
TITLE_NO_PREFIX=$(echo "$ISSUE_TITLE" | sed -e "s/$PREFIX : //")
CLEAN_TITLE=$(echo "$TITLE_NO_PREFIX" | iconv -c -f utf-8 -t ascii//TRANSLIT | sed 's/[^a-zA-Z0-9\-]//g' | tr "[:upper:]" "[:lower:]")
BRANCH_NAME="${PREFIX}/${ISSUE_NUMBER}-${CLEAN_TITLE}"
echo "Creating branch with name: $BRANCH_NAME"
# 디버깅을 위한 현재 브랜치 상태 출력
echo "Current branch:"
git branch
git checkout -b "$BRANCH_NAME"
git push --set-upstream "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}" "$BRANCH_NAME" 2>&1 | tee push_output.txt
if [ "${PIPESTATUS[0]}" != "0" ]; then
echo "Failed to push branch $BRANCH_NAME"
echo "Debug output:"
cat push_output.txt
exit 1
fi
echo "Pushed $BRANCH_NAME successfully."