Skip to content

Commit 37c3d81

Browse files
committed
Add support for placeholder merge requests
1 parent a562e12 commit 37c3d81

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,18 @@ Set to `true` (default) to enable using the [GitHub preview API for importing is
206206

207207
### usePlaceholderIssuesForMissingIssues
208208

209+
NOTE: This setting requires `usePlaceholderIssuesForMissingMergeRequests` to be set to `false` (default).
210+
209211
If this is set to `true` (default) then the migration process will automatically create empty dummy issues for every 'missing' GitLab issue (if you deleted a GitLab issue for example). Those issues will be closed on Github and they ensure that the issue ids stay the same on both GitLab and Github.
210212

213+
### usePlaceholderIssuesForMissingMergeRequests
214+
215+
NOTE: GitLab has distinct numbers for issues and merge requests whereas GitHub treats pull requests as issues.
216+
Only use this setting if your GitLab repository does not have issues or you do not intend on migrating them.
217+
This setting therefore requires `usePlaceholderIssuesForMissingIssues` to be set to `false`.
218+
219+
If this is set to `true` then the migration process will automatically create empty dummy issues for every 'missing' GitLab merge request (if you deleted a GitLab merge request for example). Those issues will be closed on Github and they ensure that the issue ids stay the same on both GitLab and Github.
220+
211221
#### usePlaceholderMilestonesForMissingMilestones
212222

213223
If this is set to `true` (default) then the migration process will automatically create empty dummy milestones for every 'missing' GitLab milestone (if you deleted a GitLab milestone for example). Those milestones will be closed on Github and they ensure that the milestone ids stay the same on both GitLab and Github.

src/githubHelper.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,15 @@ export class GithubHelper {
900900
async createPullRequestAndComments(
901901
mergeRequest: GitLabMergeRequest
902902
): Promise<void> {
903+
// Use the issue creation for placeholder issues
904+
if (mergeRequest.isPlaceholder) {
905+
let issue = mergeRequest as unknown;
906+
await this.createIssueAndComments(issue as GitLabIssue);
907+
console.log(`Created placeholder issue for placeholder merge request #${mergeRequest.iid}`);
908+
909+
return;
910+
}
911+
903912
let pullRequestData = await this.createPullRequest(mergeRequest);
904913

905914
// createPullRequest() returns an issue number if a PR could not be created and

src/settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default interface Settings {
2424
useIssueImportAPI: boolean;
2525
usePlaceholderMilestonesForMissingMilestones: boolean;
2626
usePlaceholderIssuesForMissingIssues: boolean;
27+
usePlaceholderIssuesForMissingMergeRequests: boolean;
2728
useReplacementIssuesForCreationFails: boolean;
2829
useIssuesForAllMergeRequests: boolean;
2930
filterByLabel?: string;

0 commit comments

Comments
 (0)