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