github twitter linkedin email rss
Migrating UserVoice Ideas to GitHub
Mar 6, 2018
3 minutes read

We are all about GitHub on the docs.microsoft.com team. We host documentation there and just recently we launched content feedback that’s storing comments in GitHub issues as well. Today, we moved all site feedback to GitHub as well.

Stacked mailboxes by the side fo the road

(Source: Pixabay)

Prior to the move, all our site suggestions and feedback were on UserVoice, and as we kept consolidating the feedback triage locations, site feedback was next in line. But how do we accomplish this?

Manually moving things over was not exactly my style, so I thought I would script it. There were two key things in place that helped me - the UserVoice Python SDK and PyGitHub. You can get the same script that I used by looking at my tools repo.

Following the script, first thing we need to define all the required automation credentials. That is - the API keys.

For UserVoice, you can get that by going to https://{your_account}.uservoice.com/admin/settings/api:

UserVoice API keys

If you are not using SSO-based authentication, you can safely skip USERVOICE_SSO_KEY.

Once you have the API keys, you can specify them in the string variables I showed above - USERVOICE_API_KEY and USERVOICE_API_SECRET.

For GitHub, you can get a standard Personal Access Token (PAT) via the developer console - https://github.com/settings/tokens. Make sure that it has repo-level access to be able to create new issues.

GitHub Personal Access Token configuration

Last but not least, GITHUB_TARGET_REPO should be set to the GitHub repo ID where the issues will be created.

Now, we need to jump to some extra cleanup pre-processing - it so happens that some suggestions contain profanities, and I wanted to make sure that we avoid posting those on GitHub once we move the issues over. After a bit of research, I’ve stumbled across this answer on Stack Overflow that showed how to implement a rudimentary filtering mechanism that works well enough for my scenario.

That’s how purifier.py came to life - we can import a new ProfanitiesFilter class:

Now we can initialize both the UserVoice and GitHub clients, and start getting the list of suggestions that were posted:

When getting the list of suggestions, I thought I would get a mirror array that contains only ideas that are still open - that means nothing that’s marked as completed or declined:

Last but not least, once the ideas are ready - moving them over to GitHub is relatively easy with the help of create_issue - depending on the existing labels you have in your GitHub repo, you can map UserVoice statuses to new GitHub issue labels.

In addition, I’ve also added an attribution string that will be representative of who originally opened the idea - that will be appended to the issue text:

And there we have it!

New GitHub issue migrated from UserVoice

30 minutes of coding saving hours of manual work - just like automation was supposed to work!


Back to posts