[add] 이슈 제목df #134
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | | |
export LANG=en_US.UTF-8 | |
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') | |
BRANCH_NAME="${PREFIX}-#${ISSUE_NUMBER}-${CLEAN_TITLE}" | |
echo "Creating branch with name: $BRANCH_NAME" | |
# Display current branch and all remote branches | |
git branch | |
git branch -r | |
git checkout -b "$BRANCH_NAME" | |
echo "Checkout to $BRANCH_NAME completed." | |
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 from push:" | |
cat push_output.txt | |
exit 1 | |
fi | |
echo "Pushed $BRANCH_NAME successfully." |