[docs] MOA-825 Claude Code 컨텍스트 문서 도메인별 분리 #596
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: | |
| if: contains(github.event.issue.body, '🎟️ 상위 작업 (Ticket Number)') | |
| 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 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/jira-issue-form.yml | |
| - name: Check if base branch exists | |
| id: check-branch | |
| run: | | |
| BASE_BRANCH="${{ steps.issue-parser.outputs.issueparser_baseBranch }}" | |
| echo "Checking if branch '$BASE_BRANCH' exists..." | |
| if git ls-remote --exit-code origin "refs/heads/${BASE_BRANCH}"; then | |
| echo "Branch exists: $BASE_BRANCH" | |
| echo "BRANCH_EXISTS=true" >> $GITHUB_ENV | |
| else | |
| echo "Branch does NOT exist: $BASE_BRANCH" | |
| echo "BRANCH_EXISTS=false" >> $GITHUB_ENV | |
| fi | |
| - name: Log Issue Parser | |
| run: | | |
| echo 'Parent Key: ${{ steps.issue-parser.outputs.issueparser_parentKey }}' | |
| echo 'Ticket Number: ${{ steps.issue-parser.outputs.issueparser_branch }}' | |
| echo 'Parsed JSON: ${{ steps.issue-parser.outputs.jsonString }}' | |
| - name: Convert markdown to Jira Syntax | |
| id: md2jira | |
| uses: peter-evans/jira2md@v1 | |
| with: | |
| input-text: | | |
| ### Github Issue Link | |
| - ${{ github.event.issue.html_url }} | |
| ${{ github.event.issue.body }} | |
| - name: Create Jira Issue | |
| if: startsWith(steps.issue-parser.outputs.issueparser_parentKey, 'FE-') && env.BRANCH_EXISTS == 'true' | |
| id: create | |
| uses: atlassian/gajira-create@v3 | |
| with: | |
| project: FE | |
| issuetype: Task | |
| summary: '${{ github.event.issue.title }}' | |
| description: '${{ steps.md2jira.outputs.output-text }}' | |
| - name: Log created issue | |
| if: startsWith(steps.issue-parser.outputs.issueparser_parentKey, 'FE-') && env.BRANCH_EXISTS == 'true' | |
| run: echo "Jira Issue ${{ steps.issue-parser.outputs.issueparser_parentKey || 'UNKNOWN' }}/${{ steps.create.outputs.issue || 'UNKNOWN' }} was created" | |
| - name: Checkout selected base branch | |
| if: startsWith(steps.issue-parser.outputs.issueparser_parentKey, 'FE-') && env.BRANCH_EXISTS == 'true' | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ steps.issue-parser.outputs.issueparser_baseBranch }} | |
| - name: Create branch with Ticket number | |
| if: startsWith(steps.issue-parser.outputs.issueparser_parentKey, 'FE-') && env.BRANCH_EXISTS == 'true' | |
| run: | | |
| GITHUB_ISSUE_NUMBER="${{ github.event.issue.number }}" | |
| JIRA_ISSUE_KEY="${{ steps.create.outputs.issue }}" | |
| CUSTOM_BRANCH_NAME="${{ steps.issue-parser.outputs.issueparser_branch }}" | |
| SAFE_BRANCH_NAME=$(echo "${CUSTOM_BRANCH_NAME}" | tr ' ' '-' | tr -cd '[:alnum:]/-') | |
| BRANCH_TYPE=$(echo "${SAFE_BRANCH_NAME}" | cut -d'/' -f1) | |
| BRANCH_DETAIL=$(echo "${SAFE_BRANCH_NAME}" | cut -d'/' -f2-) | |
| if [ -z "$BRANCH_DETAIL" ]; then | |
| BRANCH_DETAIL="$BRANCH_TYPE" | |
| fi | |
| BRANCH_NAME="${BRANCH_TYPE}/#${GITHUB_ISSUE_NUMBER}-${BRANCH_DETAIL}-${JIRA_ISSUE_KEY}" | |
| git checkout -b "${BRANCH_NAME}" | |
| git push origin "${BRANCH_NAME}" | |
| - name: Define issue number with fallback | |
| if: startsWith(steps.issue-parser.outputs.issueparser_parentKey, 'FE-') && env.BRANCH_EXISTS == 'true' | |
| run: | | |
| if [ -z "${{ steps.create.outputs.issue }}" ]; then | |
| echo "ISSUE_NUMBER=UNKNOWN" >> $GITHUB_ENV | |
| else | |
| echo "ISSUE_NUMBER=${{ steps.create.outputs.issue }}" >> $GITHUB_ENV | |
| fi | |
| - name: Update issue title with branch type and Jira issue key | |
| if: startsWith(steps.issue-parser.outputs.issueparser_parentKey, 'FE-') && env.BRANCH_EXISTS == 'true' | |
| run: | | |
| CUSTOM_BRANCH_NAME="${{ steps.issue-parser.outputs.issueparser_branch }}" | |
| JIRA_ISSUE_KEY="${{ steps.create.outputs.issue }}" | |
| BRANCH_TYPE=$(echo "${CUSTOM_BRANCH_NAME}" | cut -d'/' -f1) | |
| echo "NEW_TITLE=[${BRANCH_TYPE}] ${JIRA_ISSUE_KEY} ${{ github.event.issue.title }}" >> $GITHUB_ENV | |
| - name: Apply updated issue title | |
| if: startsWith(steps.issue-parser.outputs.issueparser_parentKey, 'FE-') && env.BRANCH_EXISTS == 'true' | |
| uses: actions-cool/issues-helper@v3 | |
| with: | |
| actions: 'update-issue' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| title: '${{ env.NEW_TITLE }}' | |
| - name: Add comment with Jira issue link | |
| if: startsWith(steps.issue-parser.outputs.issueparser_parentKey, 'FE-') && env.BRANCH_EXISTS == 'true' | |
| uses: actions-cool/issues-helper@v3 | |
| with: | |
| actions: 'create-comment' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| issue-number: ${{ github.event.issue.number }} | |
| body: 'Jira Issue Created: [${{ env.ISSUE_NUMBER }}](${{ secrets.JIRA_BASE_URL }}/browse/${{ env.ISSUE_NUMBER }})' |