refactor(gitea client): 移除無呼叫端的 addLabelsToIssue
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
f341dc6e07
commit
0a51affa72
@@ -168,27 +168,6 @@ function createIssue(ctx, { title, body, labels }) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 為既有 issue 追加標籤(不影響既有標籤)。
|
||||
* 對應 endpoint:`POST /repos/{owner}/{repo}/issues/{issueNumber}/labels`。
|
||||
* `labels` 為空陣列時不呼叫 API、直接回傳 `null`(省一次無意義請求)。
|
||||
*
|
||||
* @param {object} ctx - 執行環境 context。必要欄位:`apiBase`、`token`、
|
||||
* `owner`(repo 擁有者)、`repo`(repo 名稱)。
|
||||
* @param {number|string} issueNumber - 目標 issue 編號。
|
||||
* @param {number[]} labels - 要追加的標籤 id 陣列。
|
||||
* @returns {Promise<object[]|null>} 追加後該 issue 的標籤陣列(依 Gitea API 回應而定);
|
||||
* `labels` 為空時回傳 `null`(未發出請求)。
|
||||
* @throws {Error} 請求失敗(非 2xx)由底層 `api` 丟出,錯誤附 `status`、`data`。
|
||||
* @remarks 使用情境:為既有 issue 動態追加標籤的通用工具(不影響既有標籤)。
|
||||
* 註:建問題模式主流程已改為「建立 issue 時一次帶入標籤」(見 `createIssue`),
|
||||
* 不再於事後補掛;本函式保留為 Gitea 客戶端的通用能力,供需要事後追加標籤的情境使用。
|
||||
*/
|
||||
function addLabelsToIssue(ctx, issueNumber, labels) {
|
||||
if (!labels || labels.length === 0) return Promise.resolve(null);
|
||||
return api(ctx, 'POST', `/repos/${ctx.owner}/${ctx.repo}/issues/${issueNumber}/labels`, { labels });
|
||||
}
|
||||
|
||||
/**
|
||||
* 建立「問題相依」關係:讓 URL 上的 issue/PR 相依於(被阻擋於)表單指定的 issue。
|
||||
* 對應 endpoint:`POST /repos/{owner}/{repo}/issues/{issueNumber}/dependencies`
|
||||
@@ -350,7 +329,6 @@ module.exports = {
|
||||
createCommentOnIssue,
|
||||
listLabels,
|
||||
createIssue,
|
||||
addLabelsToIssue,
|
||||
addIssueDependency,
|
||||
listIssueComments,
|
||||
editIssueComment,
|
||||
|
||||
Reference in New Issue
Block a user