Skip to content

Add PR size labeler workflow for automated code review optimization#19

Merged
noracami merged 4 commits intomainfrom
copilot/add-size-labeler-workflow
Nov 21, 2025
Merged

Add PR size labeler workflow for automated code review optimization#19
noracami merged 4 commits intomainfrom
copilot/add-size-labeler-workflow

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

Implements automated PR size labeling to improve code review efficiency by surfacing PR complexity at a glance.

Changes

  • Added .github/workflows/pr-size.yml using codelytv/pr-size-labeler@v1
  • Configured size thresholds: XS (<10), S (<50), M (<200), L (<500), XL (<1000), XXL (>1000 lines)
  • Excluded auto-generated files from size calculation: package-lock.json, yarn.lock, dist/**
  • Set minimal permissions: pull-requests:write, contents:read

Workflow Configuration

on:
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  label-size:
    steps:
      - uses: codelytv/pr-size-labeler@v1
        with:
          xs_max_size: '10'
          s_max_size: '50'
          m_max_size: '200'
          l_max_size: '500'
          xl_max_size: '1000'
          xxl_label: 'size/XXL'
          files_to_ignore: 'package-lock.json,yarn.lock,dist/**'

Labels will auto-apply on PR open/update. Action will create labels if they don't exist in the repository.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Infrastructure] 實作 PR 自動標示尺寸 (Size Labeler) workflow</issue_title>
<issue_description>### 🎯 目標 (Goal) 為了優化團隊的 Code Review 效率,我們需要一個自動化機制,能夠根據 PR 的更動行數自動貼上對應的 Label (e.g., size/S, size/L)。

這項任務的目的是建立一個 GitHub Action Workflow,同時這也是一個練習 CI/CD 配置與 GitHub 協作流程的好機會。

🛠 規格需求 (Requirements)

工具選擇:請研究並使用現有的開源 Action(推薦:codelytv/pr-size-labeler 或其他類似工具)。

觸發條件:當 PR 被開啟 (opened)、同步更新 (synchronize) 或重新開啟 (reopened) 時觸發。

標籤級距 (Thresholds):

size/XS: < 10 行

size/S: < 50 行

size/M: < 200 行

size/L: < 500 行

size/XL: < 1000 行

size/XXL: > 1000 行 (請確保 Workflow 能自動建立這些 Label,若 Action 不支援自動建立,請手動在 Repo 設定中建立)

⚠️ 重要細節 (Critical):

必須設定 Ignore Files。

請查閱文件,確保 package-lock.json, yarn.lock, 以及 dist/ 等自動生成檔案不被計入行數,否則標籤會失去參考價值。

✅ 驗收標準 (Definition of Done)

請依序完成以下步驟以視為完成:

  • 建立分支:開一個新的 feature branch 進行設定。
  • 提交設定:新增 .github/workflows/pr-size.yml (命名可自訂)。
  • 自我測試 (Self-Verification):
  • 提交一個包含大量更動的 PR (可以改動 lock file),確認是否正確忽略了 lock file (不應標示為 XXL)。
  • 提交一個小更動,確認是否有正確標上 size/XS 或 size/S。
  • Code Review:發起 PR 並指派給負責人審閱。
  • Merge:通過審核後,將功能合併回主分支。

📚 參考資源 (Resources)

GitHub Actions Documentation

codelytv/pr-size-labeler (建議閱讀 ignore_files 參數的說明)


本內容由 Google Gemini 輔助產生。</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 21, 2025
Copilot AI and others added 3 commits November 21, 2025 06:31
Co-authored-by: tom00502 <9986381+tom00502@users.noreply.github.com>
Co-authored-by: tom00502 <9986381+tom00502@users.noreply.github.com>
Co-authored-by: tom00502 <9986381+tom00502@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement automatic size labeling for PRs Add PR size labeler workflow for automated code review optimization Nov 21, 2025
Copilot AI requested a review from tom00502 November 21, 2025 06:37
@tom00502 tom00502 marked this pull request as ready for review November 21, 2025 06:40
@tom00502 tom00502 requested a review from noracami November 21, 2025 06:42
@tom00502
Copy link
Member

@noracami please review and merge this pr :)

@noracami noracami merged commit 2c82b06 into main Nov 21, 2025
2 checks passed
@noracami noracami deleted the copilot/add-size-labeler-workflow branch November 21, 2025 06:46
@noracami noracami mentioned this pull request Jan 17, 2026
50 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Infrastructure] 實作 PR 自動標示尺寸 (Size Labeler) workflow

3 participants