From a3d225483309dce5829ee4d9e1bb8102f47df61c Mon Sep 17 00:00:00 2001 From: Jiyong Jung Date: Thu, 26 Mar 2026 19:57:38 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9D=B4=EC=8A=88=20=EB=B8=8C=EB=9E=9C?= =?UTF-8?q?=EC=B9=98=20=EC=83=9D=EC=84=B1=EC=9D=84=20=EB=9D=BC=EB=B2=A8=20?= =?UTF-8?q?=EA=B8=B0=EB=B0=98=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20-?= =?UTF-8?q?=20#223?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue-automation.yml | 34 +++++++++++--------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/.github/workflows/issue-automation.yml b/.github/workflows/issue-automation.yml index 18054698..6a619979 100644 --- a/.github/workflows/issue-automation.yml +++ b/.github/workflows/issue-automation.yml @@ -2,7 +2,7 @@ name: Issue Auto Assign & Create Branch on: issues: - types: [opened, reopened] + types: [labeled] permissions: issues: write @@ -12,40 +12,34 @@ jobs: auto: runs-on: ubuntu-latest steps: - - name: Assign author + create branch (linked -> fallback) + - name: Create branch based on label uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const issue = context.payload.issue; + const label = context.payload.label; const title = issue?.title ?? ""; const issueNumber = issue?.number; - const author = issue?.user?.login; - if (!issueNumber || !author) { - core.setFailed("Missing issue number or author."); + if (!issueNumber) { + core.setFailed("Missing issue number."); return; } - try { - await github.rest.issues.addAssignees({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issueNumber, - assignees: [author], - }); - console.log(`✅ Assigned: ${author}`); - } catch (e) { - console.warn(`⚠️ Assign failed (continue): ${e.message}`); + // 허용된 타입 라벨인지 확인 + const allowed = new Set(["feat","fix","refactor","docs","chore","test","style"]); + const labelName = label?.name?.toLowerCase() ?? ""; + + if (!allowed.has(labelName)) { + console.log(`ℹ️ Label "${label?.name}" is not a type label. Skipping.`); + return; } - const allowed = new Set(["feat","fix","refactor","docs","chore","test","style","qa"]); - const m = title.match(/^([a-zA-Z]+)\s*:/); - let type = (m?.[1] ?? "chore").toLowerCase(); - if (!allowed.has(type)) type = "chore"; + const type = labelName; // Parse Linear issue ID from title (e.g., [TWI-123]) - const linearMatch = title.match(/\[(TWI-\d+)\]/); + const linearMatch = title.match(/\[?(TWI-\d+)\]?/); const linearId = linearMatch?.[1]; const branchName = linearId