refactor(標籤): 把列標籤抽到 lib,讓要貼標籤的腳本共用
labels-list 與後續要挑標籤的腳本都要打同一個端點,抽成 lib.listLabels 之後 端點只寫在一個地方。順帶把「本專案不建立標籤,這是取得標籤的唯一途徑」寫進 函式註解,讓下一個要加功能的人先看到這條界線。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user