Andrew Schmelyun's Raspberry Pi-Powered Printer Makes GitHub Issues Into Physical Tickets
Developer Andrew Schmelyun has found a novel use for a receipt printer: turning GitHub Issues into physical tickets, easily visible even when access to GitHub isn't available.
"I have a lot of side projects on GitHub," Schmelyun explains. "I've been occasionally writing new issues down on sticky notes whenever I see a notification for an issue, but I always wanted an excuse to streamline the process a bit more. After seeing a receipt printer spitting out orders while grabbing some take-out the other day, I wondered if I could use one to print out a ticket each time an issue was added to one of my repos."
To drive the system, Schmelyun opted for the low-cost low-power Raspberry Pi Zero W single-board computer, powered via USB. To this, he connected an off-the-shelf Epson TM-T88IV receipt printer, suitably loaded with thermal paper.
"The reason that I went with an Epson thermal printer is that they use the ESC/POS command set, for which there's established libraries in a variety of programming languages," Schmelyun says. "Plus they're pretty ubiquitous in the second-hand market, and I was able to pick one up on Ebay along with some receipt paper for a pretty fair price."
A PHP server running on the Raspberry Pi, tunneled via ngrok to avoid having to expose the server publicly, acts as the end point for a webhook on GitHub — triggered when a new issue is filed. A JSON file provided by GitHub is decoded for relevant details, and the result neatly formatted and printed entirely automatically.
"This is definitely a simple proof of concept, but we can expand on it a few different ways," Schmelyun says. "For the tickets themselves, a QR code could be added to link directly to the issue on GitHub. You could also add in more details from the issue itself like tags and severity.
"You could also use this concept to handle basically any data coming from a webhook or through an API request. Like printing tickets from apps like Jira or Bugsnag, exceptions thrown from production applications, or even daily to-do items and grocery lists!"
A full write-up of the project is available on Schmelyun's website, while the source code has been published to — where else — GitHub under an unspecified open source license.