From 5ff8497f64cc008c5ae93fb97391fbe83de4a6ab Mon Sep 17 00:00:00 2001 From: Joey Wu Date: Mon, 16 Nov 2026 16:08:30 +0800 Subject: [PATCH] chore: add team process templates --- .github/ISSUE_TEMPLATE/task.yml | 49 +++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/user-story.yml | 45 ++++++++++++++++++++++++ .github/pull_request_template.md | 27 ++------------- .github/workflows/pr-check.yml | 30 ++++++++++++++++ .github/workflows/setup-labels.yml | 36 ++++++++++++++++++++ WORKING_AGREEMENT.md | 42 +++++++++++++++++++++++ 6 files changed, 204 insertions(+), 25 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/task.yml create mode 100644 .github/ISSUE_TEMPLATE/user-story.yml create mode 100644 .github/workflows/pr-check.yml create mode 100644 .github/workflows/setup-labels.yml create mode 100644 WORKING_AGREEMENT.md diff --git a/.github/ISSUE_TEMPLATE/task.yml b/.github/ISSUE_TEMPLATE/task.yml new file mode 100644 index 00000000..ddba9bce --- /dev/null +++ b/.github/ISSUE_TEMPLATE/task.yml @@ -0,0 +1,49 @@ +name: 開發任務 (Backlog Task) +description: 從 User Story 拆出來、一個人能從頭做到尾的工作 +title: "[Task] " +labels: ["task"] +# Milestone(Sprint 1 / Sprint 2 / Stretch)和 Assignee 請在建立後從右側欄設定。 +body: + - type: input + id: story + attributes: + label: 來自哪個 User Story + placeholder: "#12" + validations: + required: true + - type: textarea + id: what + attributes: + label: 要做什麼 + validations: + required: true + - type: input + id: hours + attributes: + label: 預估時數 + placeholder: "6" + validations: + required: true + - type: dropdown + id: size + attributes: + label: T-shirt 尺寸 + options: [S(半天內), M(1~2 天), L(3~5 天), XL(太大,請再拆)] + validations: + required: true + - type: input + id: deps + attributes: + label: 依賴(要等哪些 issue 先完成?沒有就寫「無」) + placeholder: "無" + validations: + required: true + - type: textarea + id: acceptance + attributes: + label: 驗收條件(怎麼知道做完了?要怎麼測?) + value: | + - [ ] + - [ ] 有測試覆蓋這個功能 + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/user-story.yml b/.github/ISSUE_TEMPLATE/user-story.yml new file mode 100644 index 00000000..82733f8e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/user-story.yml @@ -0,0 +1,45 @@ +name: 使用者故事 (User Story) +description: As a [角色], I want [功能], so that [價值] +title: "[Story] " +labels: ["user-story"] +body: + - type: input + id: role + attributes: + label: As a(誰?) + placeholder: 第一次接觸這個 codebase 的學生 + validations: + required: true + - type: input + id: function + attributes: + label: I want(想要什麼功能?) + placeholder: 在側邊欄看到每個檔案的一句話摘要 + validations: + required: true + - type: input + id: value + attributes: + label: So that(為什麼?帶來什麼價值?) + placeholder: 我能更快找到要改的地方 + validations: + required: true + - type: dropdown + id: impact + attributes: + label: Impact(對使用者多重要) + options: [高, 中, 低] + validations: + required: true + - type: dropdown + id: effort + attributes: + label: Effort(要花多少力氣) + options: [低, 中, 高] + validations: + required: true + - type: textarea + id: why + attributes: + label: 排序理由 + description: 為什麼給這個 Impact/Effort?(1~2 句) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 393bf905..a70a7958 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,29 +1,6 @@ -### Issue for this PR - Closes # -### Type of change - -- [ ] Bug fix -- [ ] New feature -- [ ] Refactor / code improvement -- [ ] Documentation - -### What does this PR do? - -Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR. - -**If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!** - -### How did you verify your code works? - -### Screenshots / recordings - -_If this is a UI change, please include a screenshot or recording._ - -### Checklist +## 改了什麼 -- [ ] I have tested my changes locally -- [ ] I have not included unrelated changes in this PR +## 如何測試(跑了什麼?為什麼足以證明它是對的?) -_If you do not follow this template your PR will be automatically rejected._ diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 00000000..336bac5b --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,30 @@ +# 檢查每個 PR:有連結 Issue(Closes #N),而且有寫「如何測試」。 +name: pr-check + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +permissions: {} + +jobs: + check: + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - name: 檢查 PR 描述 + env: + # 透過環境變數傳入,避免 PR 內容被當成指令執行。 + BODY: ${{ github.event.pull_request.body }} + run: | + fail=0 + if ! grep -qiE '(close[sd]?|fix(e[sd])?|resolve[sd]?) +#[0-9]+' <<<"$BODY"; then + echo "::error::PR 描述要有 'Closes #'" + fail=1 + fi + testing=$(awk '/^## 如何測試/{f=1;next} /^## /{f=0} f' <<<"$BODY" | grep -vE '^\s*$' || true) + if [ -z "$testing" ]; then + echo "::error::請填寫「## 如何測試」段落" + fail=1 + fi + exit $fail diff --git a/.github/workflows/setup-labels.yml b/.github/workflows/setup-labels.yml new file mode 100644 index 00000000..0b593a42 --- /dev/null +++ b/.github/workflows/setup-labels.yml @@ -0,0 +1,36 @@ +# 一次性設定:建立 labels 和 milestones。 +# 用法:GitHub 網頁 → Actions → setup-labels → Run workflow。重跑也安全。 +name: setup-labels + +on: + workflow_dispatch: + +permissions: + issues: write + +jobs: + setup: + runs-on: ubuntu-latest + timeout-minutes: 2 + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + steps: + - name: 建立 labels + run: | + gh label create user-story --color 5319e7 --description "使用者故事" --force + gh label create task --color 0e8a16 --description "從故事拆出的開發任務" --force + gh label create bug --color d73a4a --description "錯誤" --force + gh label create "priority:high" --color b60205 --description "高 Impact、低 Effort:先做" --force + gh label create "priority:mid" --color fbca04 --description "值得做,排後面" --force + gh label create "priority:low" --color c5def5 --description "有空再說" --force + + - name: 建立 milestones + run: | + for m in "Sprint 1" "Sprint 2" "Stretch"; do + if gh api "repos/$GH_REPO/milestones?state=all" --jq '.[].title' | grep -qx "$m"; then + echo "已存在:$m" + else + gh api "repos/$GH_REPO/milestones" -f title="$m" --silent && echo "已建立:$m" + fi + done diff --git a/WORKING_AGREEMENT.md b/WORKING_AGREEMENT.md new file mode 100644 index 00000000..9b42a478 --- /dev/null +++ b/WORKING_AGREEMENT.md @@ -0,0 +1,42 @@ +# 工作約定(Working Agreement) + +> 原作業中的「團隊契約」。一個人做時,這份是寫給「未來的自己」看的。最多 1 頁,只寫你真的會遵守的事。 + +## 1. 時間投入 +- 每週投入:__ 小時(原作業假設每人每週 8 小時) +- 固定工作時段:__(例:週二、週四 20:00–22:00) +- 臨時有事時:__(例:當週把 Todo 少拉一張卡) + +## 2. 溝通與紀錄 +- 工作紀錄放在:GitHub Issues 和 Project 看板 +- 每次工作結束前:更新卡片狀態,並在 issue 留一句「做到哪、下一步」 +- (團隊版)用什麼工具溝通?多久內要回覆? + +## 3. 固定檢查點 +- 每週一次,每次 15 分鐘:看看板 → 把卡從 Backlog 拉到 Todo → 調整預估時數 +- 每個 Sprint 結束:寫 Keep/Start/Stop 回顧(範本見下方) + +## 4. 分工與角色 +- 一次只做一張 In Progress 的卡 +- 每張卡:一個 branch → 一個 PR → `Closes #N` +- (團隊版)誰負責主持會議、誰做紀錄、怎麼輪替? + +## 5. 卡住或落後時怎麼辦 +- 同一個問題卡超過 __ 小時:先寫下問題,再去查或發問 +- Sprint 只完成不到一半:縮小範圍,把部分卡移到 Stretch +- (團隊版)有人貢獻太少時的處理步驟,以及何時找老師或主管介入 + +--- + +簽名:____ 日期:____ + +--- + +## Sprint 回顧範本(每個 Sprint 結束時複製一份) + +| | 內容 | +|---|---| +| Keep(繼續做) | | +| Start(開始做) | | +| Stop(停止做) | | +| 預估 vs 實際時數 | 預估 _ 小時/實際 _ 小時 |