It should be possible with the API and/or a plugin. The Discourse GitHub could be an example that you could follow.