feat/sdlc-plan-requirement-issue/main #21

Merged
admin merged 6 commits from feat/sdlc-plan-requirement-issue/main into master 2026-09-17 04:51:03 +00:00
2 changed files with 17 additions and 3 deletions
Showing only changes of commit 4f542d9c86 - Show all commits
+2 -3
View File
@@ -8,8 +8,7 @@
* 用法:node scripts/labels-list.js --repo owner/name [--host <網址>] [--dry-run] * 用法:node scripts/labels-list.js --repo owner/name [--host <網址>] [--dry-run]
*/ */
import { import {
expectOk, listLabels,
giteaRequest,
main, main,
parseFlags, parseFlags,
parseRepo, parseRepo,
@@ -40,7 +39,7 @@ main(async () => {
const login = resolveLogin({ host: flags.host }); const login = resolveLogin({ host: flags.host });
await preflight(login, repo); await preflight(login, repo);
const labels = expectOk(await giteaRequest(login, 'GET', path), `GET ${path}`) ?? []; const labels = await listLabels(login, repo);
return { return {
repo, repo,
+15
View File
@@ -418,6 +418,21 @@ function checkTimeTracker(info) {
} }
} }
// ── 標籤 ───────────────────────────────────────────────────────────
/**
* 取得 repo 上的既有標籤。
* 本專案不建立標籤,所以這是取得標籤的唯一途徑:要貼標籤的腳本先從這裡拿清單,
* 挑不到合適的就不貼。
* @param {{base: string, token: string}} login
* @param {string} repo owner/name
* @returns {Promise<object[]>}
*/
export async function listLabels(login, repo) {
const path = `/repos/${repo}/labels`;
return expectOk(await giteaRequest(login, 'GET', path), `GET ${path}`) ?? [];
}
// ── 冪等查重 ─────────────────────────────────────────────────────── // ── 冪等查重 ───────────────────────────────────────────────────────
/** /**