piceaTech / node-gitlab-2-github

Migrate Issues, milestones etc from gitlab to github
MIT License
555 stars 136 forks source link

Avoid @-mentioning users #79

Closed asottile closed 3 years ago

asottile commented 4 years ago

Would there be interest in implementing such a feature? A repository was just migrated and I received 50+ emails from the scripts!

A similar script I've used in the past for bitbucket => github avoids mentioning / assigning but preserves usernames by linking them directly: https://github.com/jeffwidman/bitbucket-issue-migration/blob/4c797925f322f49956e3dc925f6dff0f2ed075ca/migrate.py#L657-L675

could be a less-noisy alternative

asottile commented 4 years ago

this would be the most straightforward patch:

diff --git a/src/githubHelper.ts b/src/githubHelper.ts
index b4af99e..baa4b7b 100644
--- a/src/githubHelper.ts
+++ b/src/githubHelper.ts
@@ -846,7 +846,7 @@ export default class GithubHelper {
       dateformatOptions
     );

-    const attribution = `In GitLab by @${item.author.username} on ${formattedDate}`;
+    const attribution = `In GitLab by [@${item.author.username}](https://gitlab.com/${item.author.username}) on ${formattedDate}`;
     const lineRef =
       item && item.position
         ? GithubHelper.createLineRef(item.position, repoLink)

this prevents emailing the user, I wasn't sure whether it should link to github or gitlab though (I'm not sure the intent of that line)

jaraco commented 4 years ago

I wasn't sure whether it should link to github or gitlab though

That's a tough one... as in theory, the usernames on GitLab and Github don't have to match, so linking to GitLab will be more correct. On the other hand, the idea is to migrate away from GitLab and in a few years, links to GitLab may not be relevant, and for most users, the username will be the same and map nicely. Since pointing to GitLab is what you've drafted, that's what I'll be using to test this technique with the migration of importlib_resources.

jaraco commented 4 years ago

I notice now that the migration tool provides a usermap, so those links should be to Github.

jaraco commented 4 years ago

GitLab provides a way to disable notifications for a project, but I don't see a way to do that in Github. If only they provided that feature and allow it to be twiddled through the API, then the migration tool could disable notifications during the migration and re-enable them at the end. That way, mentions could still trigger subscription to salient issues also.

jaraco commented 4 years ago

Testing hyperlink-only notification suppression: @warsaw shouldn't get notified here (or be subscribed to the issue).

jaraco commented 4 years ago

Confirmed - it's not necessary to have a zero-width space. Just enclosing the mention in an explicit hyperlink seemed to have suppressed the mention mechanics.

jaraco commented 4 years ago

Users have reported that email notices are still happening with this change present.