Skip to content

Commit

Permalink
Update create-jira-issue.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
hooni0918 authored Jun 29, 2024
1 parent 6ecea6a commit f7a9c9d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/create-jira-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,21 @@ jobs:
echo "Jira API response: $RESPONSE"
JIRA_ISSUE_KEY=$(echo "$RESPONSE" | grep -oP '(?<=key\":\")\w+-\d+')
echo "JIRA_ISSUE_KEY=$JIRA_ISSUE_KEY" >> $GITHUB_ENV
- 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"
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH_NAME"
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}" "$BRANCH_NAME"

0 comments on commit f7a9c9d

Please sign in to comment.