zhaoyingbo da1c5f7580
All checks were successful
CI Monitor CI/CD / build-image (push) Successful in 32s
CI Monitor CI/CD / deploy (push) Successful in 40s
feat: 支持对PipeLine WebHooks的处理 #1
2024-07-26 07:17:32 +00:00

24 lines
663 B
TypeScript

import { Gitlab } from "../../types/gitlab"
import netTool from "../netTool"
import { GITLAB_AUTH_HEADER, GITLAB_BASE_URL, gitlabReqWarp } from "./tools"
/**
* 检索与特定提交关联的合并请求。
* @param project_id - 项目的ID。
* @param sha - 提交的SHA。
* @returns 一个解析为合并请求数组的promise。
*/
const getMr = async (project_id: number, sha: string) => {
const URL = `${GITLAB_BASE_URL}/projects/${project_id}/repository/commits/${sha}/merge_requests`
return gitlabReqWarp<Gitlab.MergeRequest[]>(
() => netTool.get(URL, {}, GITLAB_AUTH_HEADER),
[]
)
}
const commit = {
getMr,
}
export default commit