refactor(標籤): 把列標籤抽到 lib,讓要貼標籤的腳本共用

labels-list 與後續要挑標籤的腳本都要打同一個端點,抽成 lib.listLabels 之後
端點只寫在一個地方。順帶把「本專案不建立標籤,這是取得標籤的唯一途徑」寫進
函式註解,讓下一個要加功能的人先看到這條界線。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-17 12:44:22 +08:00
co-authored by Claude Opus 5
parent c699fe7197
commit 28dc2ffab8
2 changed files with 17 additions and 3 deletions
+2 -3
View File
@@ -8,8 +8,7 @@
* 用法:node scripts/labels-list.js --repo owner/name [--host <網址>] [--dry-run]
*/
import {
expectOk,
giteaRequest,
listLabels,
main,
parseFlags,
parseRepo,
@@ -40,7 +39,7 @@ main(async () => {
const login = resolveLogin({ host: flags.host });
await preflight(login, repo);
const labels = expectOk(await giteaRequest(login, 'GET', path), `GET ${path}`) ?? [];
const labels = await listLabels(login, repo);
return {
repo,