zhaoyingbo f5ee6f8555
All checks were successful
CI Monitor MIflow / build-image (push) Successful in 45s
feat: 修改监控Stage的方式
2024-08-08 11:04:09 +00:00

27 lines
752 B
TypeScript

import { Gitlab } from "../../types/gitlab"
import netTool from "../netTool"
import { GITLAB_AUTH_HEADER, GITLAB_BASE_URL, gitlabReqWarp } from "./tools"
/**
* 检索与特定提交关联的合并请求。
* @param {number} project_id - 项目的ID。
* @param {string} sha - 提交的SHA。
* @returns {Promise<Gitlab.MergeRequest[]>} 一个解析为合并请求数组的promise。
*/
const getMr = async (
project_id: number,
sha: string
): Promise<Gitlab.MergeRequest[]> => {
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