How to Copy GitHub Labels from One Project to Another

My GitHub project consists of several sub-projects. To make the labels consistent, we can use some tool to copy the label from one project to another. In this instance, I want to copy the labels from “bemusic/bemuse” to “bemusic/bms-js”.

I’ll use a web-based tool called “GitHub Label Manager” by @destan.

First, go to GitHub’s Applications settings and generate a new personal access token.

Then go to GitHub Label Manager, and type in the name of the destination project. Fill in your username, and put in the generated token as the password. Click the “List labels in this repo” button. You’ll see the list of existing labels in the destination repo.

For each label, click the “Delete” button to delete existing labels. Next, click the “Copy an existing repo’s labels” button, type in the source repo, and click “Copy.” You should see the labels from your source repo.

Finally, click “Commit Changes” to save changes.

And that’s it. Since I do this for just few projects, it’s OK for me to just use a GUI tool. However, if I have to do this a lot in the future, I may write a Ruby script to automate this process for me — because laziness. With help of GitHub libraries like github_api or Octokit it should be doable in ~20 lines of code.