EA3-200 Refactor: 스터디 신청 기능 리팩터링 #59
This file contains hidden or 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 | |
| on: | |
| issues: | |
| types: | |
| - opened | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| create-issue: | |
| name: Create Jira issue | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Login | |
| uses: atlassian/gajira-login@v3 | |
| env: | |
| JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | |
| JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | |
| JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} | |
| - name: Checkout develop code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: develop | |
| - name: Issue Parser | |
| uses: stefanbuck/github-issue-praser@v3 | |
| id: issue-parser | |
| with: | |
| template-path: .github/ISSUE_TEMPLATE/issue-form.yml | |
| - name: Log Issue Parser | |
| run: | | |
| echo '${{ steps.issue-parser.outputs.issueparser_parentKey }}' | |
| echo '${{ steps.issue-parser.outputs.__ticket_number }}' | |
| echo '${{ steps.issue-parser.outputs.jsonString }}' | |
| - name: Convert markdown to Jira Syntax | |
| uses: peter-evans/jira2md@v1 | |
| id: md2jira | |
| with: | |
| input-text: | | |
| ### Github Issue Link | |
| - ${{ github.event.issue.html_url }} | |
| ${{ github.event.issue.body }} | |
| mode: md2jira | |
| - name: Map GitHub label to Jira issuetype | |
| run: | | |
| LABEL="${{ steps.issue-parser.outputs.issueparser_label-selection }}" | |
| case "$LABEL" in | |
| fix) JIRA_ISSUETYPE="버그" ;; | |
| feature|docs|style|refactor|test|chore) JIRA_ISSUETYPE="Task" ;; | |
| *) JIRA_ISSUETYPE="Task" ;; | |
| esac | |
| echo "JIRA_ISSUETYPE=$JIRA_ISSUETYPE" >> $GITHUB_ENV | |
| - name: Create Issue | |
| id: create | |
| uses: atlassian/gajira-create@v3 | |
| with: | |
| project: EA3 | |
| issuetype: ${{ env.JIRA_ISSUETYPE }} | |
| summary: '${{ github.event.issue.title }}' | |
| description: '${{ steps.md2jira.outputs.output-text }}' | |
| fields: | | |
| { | |
| "parent": { | |
| "key": "${{ steps.issue-parser.outputs.issueparser_parentKey }}" | |
| }, | |
| "labels": ["${{ steps.issue-parser.outputs.issueparser_team-selection }}"] | |
| } | |
| - name: Log created issue | |
| run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.create.outputs.issue }} was created" | |
| - name: Checkout develop code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: develop | |
| - name: Convert label-selection to Capitalized TYPE | |
| run: | | |
| LABEL="${{ steps.issue-parser.outputs.issueparser_label-selection }}" | |
| case "$LABEL" in | |
| feature) TYPE="Feature" ;; | |
| fix) TYPE="Fix" ;; | |
| docs) TYPE="Docs" ;; | |
| style) TYPE="Style" ;; | |
| refactor) TYPE="Refactor" ;; | |
| test) TYPE="Test" ;; | |
| chore) TYPE="Chore" ;; | |
| *) TYPE="$LABEL" ;; | |
| esac | |
| echo "TYPE=$TYPE" >> $GITHUB_ENV | |
| - name: Map label to custom GitHub label | |
| run: | | |
| RAW_LABEL="${{ steps.issue-parser.outputs.issueparser_label-selection }}" | |
| case "$RAW_LABEL" in | |
| feature) CUSTOM_LABEL="✨ feature" ;; | |
| fix) CUSTOM_LABEL="🐛 fix" ;; | |
| docs) CUSTOM_LABEL="📝 docs" ;; | |
| style) CUSTOM_LABEL="💄 style" ;; | |
| refactor) CUSTOM_LABEL="♻️ refactor" ;; | |
| test) CUSTOM_LABEL="🚨 test" ;; | |
| chore) CUSTOM_LABEL="🔧 chore" ;; | |
| *) CUSTOM_LABEL="$RAW_LABEL" ;; | |
| esac | |
| echo "CUSTOM_LABEL=$CUSTOM_LABEL" >> $GITHUB_ENV | |
| - name: Update issue title | |
| uses: actions-cool/issues-helper@v3 | |
| with: | |
| actions: 'update-issue' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| title: '${{ steps.create.outputs.issue }} ${{ env.TYPE }}: ${{ github.event.issue.title }}' | |
| - name: Log Issue Parser | |
| run: | | |
| echo "assignee => ${{ steps.issue-parser.outputs.issueparser_assignee }}" | |
| echo "label => ${{ steps.issue-parser.outputs.issueparser_label-selection }}" | |
| - name: Debug Assignee and Label | |
| run: | | |
| echo "Assignee: ${{ steps.issue-parser.outputs.issueparser_assignee }}" | |
| echo "Label: ${{ steps.issue-parser.outputs.issueparser_label-selection }}" | |
| - name: Add GitHub label to issue | |
| uses: actions-cool/issues-helper@v3 | |
| with: | |
| actions: 'add-labels' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| issue-number: ${{ github.event.issue.number }} | |
| labels: | | |
| ${{ env.CUSTOM_LABEL }} | |
| - name: Create branch with Epic number | |
| if: steps.issue-parser.outputs.issueparser_label-selection != 'fix' | |
| run: | | |
| ISSUE_KEY="${{ steps.create.outputs.issue }}" # GIT-8 | |
| RAW_TITLE="${{ steps.issue-parser.outputs.issueparser_branch }}" # login | |
| TYPE=$(echo "${{ env.TYPE }}" | tr '[:upper:]' '[:lower:]') # feature | |
| # 기능명을 소문자로 변환 + 공백/특수문자 제거 | |
| SANITIZED_TITLE=$(echo "$RAW_TITLE" | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g' | sed 's/[^a-z0-9_-]//g') | |
| BRANCH_NAME="${TYPE}/${ISSUE_KEY}-${SANITIZED_TITLE}" # feature/GIT-8-login | |
| echo "📌 Branch to be created: $BRANCH_NAME" | |
| git checkout -b "${BRANCH_NAME}" | |
| git push origin "${BRANCH_NAME}" | |
| - name: Add comment with Jira issue link | |
| uses: actions-cool/issues-helper@v3 | |
| with: | |
| actions: 'create-comment' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| issue-number: ${{ github.event.issue.number }} | |
| body: 'Jira Issue Created: [${{ steps.create.outputs.issue }}](${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.create.outputs.issue }})' | |
| - name: Assign issue to user | |
| uses: actions-cool/issues-helper@v3 | |
| with: | |
| actions: 'add-assignees' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| issue-number: ${{ github.event.issue.number }} | |
| assignees: ${{ steps.issue-parser.outputs.issueparser_assignee }} | |