Sunday , 26 March 2017
Home » Technology » Development » Importing GitHub Milestones, Labels, Issues, Comments from One Repository to Another

Importing GitHub Milestones, Labels, Issues, Comments from One Repository to Another

I was tasked today to duplicate and import all the GitHub milestones, labels, issues, and comments from one repository to nine other repositories. Of course, as a developer, we would rather spend time searching for or writing code than manually duplicating everything.

Here’s the code from gist.github.com called github-import-issues.

What the script does:

  • Clean up the destination repository:
    • Remove all existing milestones from the destination repository; and
    • Remove all existing labels from the destination repository.
  • Import the settings of the source repository to the destination repository:
    • Import the source milestones to the destination repository;
    • Import the source labels to the destination repository; and
    • Import, in the order in which they were originally created, the source issues (both open and closed) to the destination repository:
      • Create the issue (incl. its title and body and, if any, its assignee, milestone and labels);
      • Import the comments associated with the issue, if any; and
      • Close the issue, if needed.

What the script does not (either due to GitHub API limitations or GitHub’s ‘features’):

  • During the cleaning up of the destination repository, existing issues are not removed. Indeed, once created, an issues simply cannot be deleted.
  • Any imported issue can only be created on your behalf rather than that of the original creator (unless it is you!). So, the best we can do, if you are not the original creator, is to edit the issue’s body and mention its original creator.
  • As for an imported issue, any comment for an imported issue will be created on your behalf, but as for an imported issue we can, if needed, edit it and mention its original creator.

About Justin Lee

Check Also

Apple WWDC 2014 Videos Podcast RSS Feed Generator using XSLT

I realised there isn’t any podcast subscription link for the Apple WWDC 2014 videos at …

Leave a Reply