renovate/lib/modules/platform/gitlab/merge-request.ts
Rhys Arkins dca3418bbd refactor: lib/modules (#14488)
Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/

BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
2022-03-04 09:04:02 +01:00

26 lines
717 B
TypeScript

import { logger } from '../../../logger';
import { gitlabApi } from './http';
import type { GitLabMergeRequest, UpdateMergeRequest } from './types';
export async function getMR(
repository: string,
iid: number
): Promise<GitLabMergeRequest> {
logger.debug(`getMR(${iid})`);
const url = `projects/${repository}/merge_requests/${iid}?include_diverged_commits_count=1`;
return (await gitlabApi.getJson<GitLabMergeRequest>(url)).body;
}
export async function updateMR(
repository: string,
iid: number,
data: UpdateMergeRequest
): Promise<void> {
logger.debug(`updateMR(${iid})`);
const url = `projects/${repository}/merge_requests/${iid}`;
await gitlabApi.putJson(url, {
body: data,
});
}