mirror of
https://github.com/kiegroup/git-backporting.git
synced 2025-07-18 12:38:26 +02:00
Base implementation
This commit is contained in:
parent
05d156a5b0
commit
74703c48f3
53 changed files with 34684 additions and 392 deletions
|
@ -1,19 +1,30 @@
|
|||
import { GitPullRequest } from "@gb/service/git/git.types";
|
||||
import { GitPullRequest } from "@bp/service/git/git.types";
|
||||
import { PullRequest, User } from "@octokit/webhooks-types";
|
||||
|
||||
export default class GitHubMapper {
|
||||
|
||||
mapPullRequest(pr: PullRequest): GitPullRequest {
|
||||
return {
|
||||
author: pr.user.login,
|
||||
url: pr.url,
|
||||
htmlUrl: pr.html_url,
|
||||
title: pr.title,
|
||||
body: pr.body,
|
||||
patchUrl: pr.patch_url,
|
||||
body: pr.body ?? "",
|
||||
state: pr.state,
|
||||
merged: pr.merged ?? false,
|
||||
mergedBy: pr.merged_by?.login,
|
||||
reviewers: pr.requested_reviewers.filter(r => "login" in r).map((r => (r as User)?.login)),
|
||||
sourceRepo: pr.head.repo.full_name,
|
||||
targetRepo: pr.base.repo.full_name,
|
||||
commits: [pr.merge_commit_sha]
|
||||
} as GitPullRequest;
|
||||
sourceRepo: {
|
||||
owner: pr.head.repo.full_name.split("/")[0],
|
||||
project: pr.head.repo.full_name.split("/")[1],
|
||||
cloneUrl: pr.head.repo.clone_url
|
||||
},
|
||||
targetRepo: {
|
||||
owner: pr.base.repo.full_name.split("/")[0],
|
||||
project: pr.base.repo.full_name.split("/")[1],
|
||||
cloneUrl: pr.base.repo.clone_url
|
||||
},
|
||||
commits: [pr.merge_commit_sha as string]
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue