[chore] 이슈 제목df #129
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' # Checkout the 'suyeon' branch | |
- 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" | |
# Check current branch and list all remote branches for debugging | |
git branch | |
git branch -r | |
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." |