[refactor] 토큰 처리 로직 리팩토링 #31
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 | |
| 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_URL }} | |
| JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | |
| JIRA_USER_EMAIL: ${{ secrets.JIRA_EMAIL }} | |
| - name: Checkout main code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Issue Parser | |
| uses: stefanbuck/github-issue-parser@v3 | |
| id: issue-parser | |
| with: | |
| template-path: .github/ISSUE_TEMPLATE/🍀다솜-이슈-템플릿.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: Derive parentKey | |
| id: derive-parent | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const body = process.env.BODY || ''; | |
| let parent = ''; | |
| try { | |
| const parsed = JSON.parse(process.env.JSON || '{}'); | |
| parent = (parsed.parentKey || '').trim(); | |
| } catch (e) {} | |
| if (!parent) { | |
| const m = body.match(/DASOMFE-\d+/i); | |
| if (m) parent = m[0].toUpperCase(); | |
| } | |
| core.setOutput('parent', parent); | |
| env: | |
| BODY: ${{ github.event.issue.body }} | |
| JSON: ${{ steps.issue-parser.outputs.jsonString }} | |
| - name: Validate parentKey | |
| run: | | |
| if [ -z "${{ steps.derive-parent.outputs.parent }}" ]; then | |
| echo "parentKey not found. Fill the form field or include like DASOMFE-2 in the body." | |
| exit 1 | |
| fi | |
| - 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: Create Issue | |
| id: create | |
| uses: atlassian/gajira-create@v3 | |
| with: | |
| project: DASOMFE | |
| issuetype: Task | |
| summary: '${{ github.event.issue.title }}' | |
| description: '${{ steps.md2jira.outputs.output-text }}' | |
| fields: | | |
| { | |
| "parent": { | |
| "key": "${{ steps.derive-parent.outputs.parent }}" | |
| } | |
| } | |
| - name: Log created issue | |
| run: echo "Jira Issue parent=${{ steps.derive-parent.outputs.parent }} created=${{ steps.create.outputs.issue }}" | |
| - name: Update issue title | |
| uses: actions-cool/issues-helper@v3 | |
| with: | |
| actions: 'update-issue' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| title: '[${{ steps.create.outputs.issue }}] ${{ github.event.issue.title }}' | |
| - 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_URL }}/browse/${{ steps.create.outputs.issue }})' |