23 lines
603 B
TypeScript
23 lines
603 B
TypeScript
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<any[]>(
|
|
() => netTool.get(URL, {}, GITLAB_AUTH_HEADER),
|
|
[]
|
|
)
|
|
}
|
|
|
|
const commit = {
|
|
getMr,
|
|
}
|
|
|
|
export default commit
|