add urls
This commit is contained in:
parent
efa01ca43d
commit
20b1bec866
|
@ -33,7 +33,8 @@ export default class Replicate extends Command {
|
|||
const sourceRepo = await sourceVendor.getRepo(sourcePath.path);
|
||||
const destRepo = await destVendor.getRepo(destPath.path);
|
||||
const sourceEntity = await sourceRepo.getIssue(sourcePath.entityID);
|
||||
sourceEntity.content += `\n\nReplicated from ${sourceEntity.url} with Copycat`;
|
||||
const replicatedEntity = await destRepo.replicateIssue(sourceEntity);
|
||||
console.log(replicatedEntity);
|
||||
console.log(`Replicated successfully: ${replicatedEntity.url}`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ export interface Repo {
|
|||
vendor: Vendor;
|
||||
owner: Actor;
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface RepoManager {
|
||||
|
@ -69,6 +70,7 @@ export interface RepoElement {
|
|||
title: string;
|
||||
content: string;
|
||||
repo: Repo;
|
||||
url: string;
|
||||
}
|
||||
|
||||
/** basic */
|
||||
|
|
6
src/vendor/github/repomgr.ts
vendored
6
src/vendor/github/repomgr.ts
vendored
|
@ -41,6 +41,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
vendor: this.vendorMgr.vendor,
|
||||
},
|
||||
name: repoName,
|
||||
url: `https://${this.vendorMgr.vendor.domain}/${repoPath}`,
|
||||
};
|
||||
this.repoId = '';
|
||||
}
|
||||
|
@ -87,6 +88,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
query Query($owner: String!, $name: String!, $number: Int!) {
|
||||
repository(owner: $owner, name: $name) {
|
||||
issue(number: $number) {
|
||||
number
|
||||
title
|
||||
body
|
||||
closed
|
||||
|
@ -110,6 +112,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
title: issue.title,
|
||||
repo: this.repo,
|
||||
state: issue.closed ? ISSUE_STATE.CLOSED : ISSUE_STATE.OPEN,
|
||||
url: `${this.repo.url}/issues/${issue.number}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -145,6 +148,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
title: replicated.title,
|
||||
repo: this.repo,
|
||||
state: replicated.closed ? ISSUE_STATE.CLOSED : ISSUE_STATE.OPEN,
|
||||
url: `${this.repo.url}/issues/${replicated.number}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -154,6 +158,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
query Query($owner: String!, $name: String!, $number: Int!) {
|
||||
repository(owner: $owner, name: $name) {
|
||||
pullRequest(number: $number) {
|
||||
number
|
||||
title
|
||||
body
|
||||
isDraft
|
||||
|
@ -189,6 +194,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
UNKNOWN: null,
|
||||
}[pullRequest.mergeable],
|
||||
isDraft: pullRequest.isDraft,
|
||||
url: `${this.repo.url}/pull/${pullRequest.number}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
5
src/vendor/gitlab/repomgr.ts
vendored
5
src/vendor/gitlab/repomgr.ts
vendored
|
@ -43,6 +43,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
vendor: this.vendorMgr.vendor,
|
||||
},
|
||||
name: repoSmallPath,
|
||||
url: `https://${this.vendorMgr.vendor.domain}/${repoPath}`,
|
||||
};
|
||||
this.repoPath = repoPath;
|
||||
this.repoId = ''; // for strict null check, is replaced in .initialize
|
||||
|
@ -94,6 +95,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
query ($path: ID!, $id: String!) {
|
||||
project(fullPath: $path) {
|
||||
issue(iid: $id) {
|
||||
iid
|
||||
title
|
||||
description
|
||||
state
|
||||
|
@ -121,6 +123,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
locked: ISSUE_STATE.CLOSED,
|
||||
all: ISSUE_STATE.CLOSED, // today's fact: gitlab api is fucked up
|
||||
}[issue.state],
|
||||
url: `${this.repo.url}/-/issues/${issue.iid}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -144,6 +147,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
query ($path: ID!, $id: String!) {
|
||||
project(fullPath: $path) {
|
||||
mergeRequest(iid: $id) {
|
||||
iid
|
||||
title
|
||||
description
|
||||
state
|
||||
|
@ -182,6 +186,7 @@ export default class GitHubRepoManager implements RepoManager {
|
|||
mergeRequest.mergeStatus || ''
|
||||
] || null,
|
||||
isDraft: mergeRequest.workInProgress,
|
||||
url: `${this.repo.url}/-/merge_requests/${mergeRequest.iid}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue