Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 sample_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
labels: true,
issues: true,
mergeRequests: true,
migrationTopic: false,
},
debug: false,
usePlaceholderIssuesForMissingIssues: true,
Expand Down
12 changes: 12 additions & 0 deletions 12 src/githubHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ export default class GithubHelper {
******************************************************************************
*/

/**
* Replace the topics of the repository on GitHub.
*/
async replaceTopics(topics) {
let props : RestEndpointMethodTypes["repos"]["replaceAllTopics"]["parameters"] = {
owner: this.githubOwner,
repo: this.githubRepo,
names: topics
}
return this.githubApi.repos.replaceAllTopics(props);
}

/**
* TODO description
*/
Expand Down
31 changes: 31 additions & 0 deletions 31 src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ async function migrate() {

await githubHelper.registerRepoId();

// set the gitlab-mr-migrating topic for the repository during the migration
if (settings.transfer.migrationTopic) {
await setMigratingTopic();
}

// transfer GitLab milestones to GitHub
if (settings.transfer.milestones) {
await transferMilestones();
Expand Down Expand Up @@ -154,11 +159,36 @@ async function migrate() {
console.error(err);
}

// set the gitlab-mr-migrated topic for the repository when migration is done
if (settings.transfer.migrationTopic) {
await setMigratedTopic();
}

console.log('\n\nTransfer complete!\n\n');
}

// ----------------------------------------------------------------------------

/**
* Set the gitlab-mr-migrating topic.
*/
async function setMigratingTopic() {
inform('Setting the gitlab-mr-migrating topic during the transfer');
await githubHelper.replaceTopics(['gitlab-mr-migrating']);
}

// ----------------------------------------------------------------------------

/**
* Set the gitlab-mr-migrated topic.
*/
async function setMigratedTopic() {
inform('Setting the gitlab-mr-migrated topic since the transfer is done');
await githubHelper.replaceTopics(['gitlab-mr-migrated']);
}

// ----------------------------------------------------------------------------

/**
* Transfer any milestones that exist in GitLab that do not exist in GitHub.
*/
Expand Down Expand Up @@ -401,6 +431,7 @@ async function transferMergeRequests() {
// if a GitLab merge request does not exist in GitHub repo, create it -- along
// with comments
for (let request of mergeRequests) {
// if (request.iid < 333) continue;
// Try to find a GitHub pull request that already exists for this GitLab
// merge request
let githubRequest = githubPullRequests.find(
Expand Down
1 change: 1 addition & 0 deletions 1 src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default interface Settings {
labels: boolean;
issues: boolean;
mergeRequests: boolean;
migrationTopic: boolean;
};
usePlaceholderIssuesForMissingIssues: boolean;
useReplacementIssuesForCreationFails: boolean;
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.