From 40d8824f1e95d4cb137cb41ce561ce00f6bea8cc Mon Sep 17 00:00:00 2001 From: Shunsuke Hayashi Date: Sat, 22 Nov 2025 17:07:13 +0900 Subject: [PATCH] chore: Add workflow issue-opened.yml --- .github/workflows/issue-opened.yml | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/issue-opened.yml diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml new file mode 100644 index 0000000..44a0811 --- /dev/null +++ b/.github/workflows/issue-opened.yml @@ -0,0 +1,60 @@ +name: Issue Opened - Auto Label + +on: + issues: + types: [opened] + +jobs: + auto-label: + runs-on: ubuntu-latest + permissions: + issues: write + contents: read + + steps: + - name: Auto-label new issue + uses: actions/github-script@v7 + with: + script: | + const title = context.payload.issue.title.toLowerCase(); + const body = (context.payload.issue.body || '').toLowerCase(); + const text = `${title} ${body}`; + + const labels = []; + + // Type labels + if (text.includes('bug') || text.includes('error') || text.includes('fix')) { + labels.push('๐Ÿ› type:bug'); + } else if (text.includes('feature') || text.includes('add') || text.includes('implement')) { + labels.push('โœจ type:feature'); + } else if (text.includes('doc') || text.includes('readme')) { + labels.push('๐Ÿ“š type:docs'); + } else if (text.includes('refactor') || text.includes('cleanup')) { + labels.push('โ™ป๏ธ type:refactor'); + } else if (text.includes('test') || text.includes('coverage')) { + labels.push('๐Ÿงช type:test'); + } + + // Priority + if (text.includes('urgent') || text.includes('critical')) { + labels.push('๐Ÿ“Š priority:P0-Critical'); + } else if (text.includes('important') || text.includes('high')) { + labels.push('โš ๏ธ priority:P1-High'); + } else { + labels.push('๐Ÿ“Š priority:P2-Medium'); + } + + // State + labels.push('๐Ÿ“ฅ state:pending'); + + // Phase + labels.push('๐ŸŽฏ phase:planning'); + + if (labels.length > 0) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.issue.number, + labels: labels + }); + }