feat/sdlc-plan-requirement-issue/main #21
@@ -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,
|
||||
|
||||
@@ -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}`) ?? [];
|
||||
}
|
||||
|
||||
// ── 冪等查重 ───────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user