GitHub is a web service that keeps track of code and files, designed to enable folks to collaborate on projects. Nearly all of Adafruit's coding projects and hardware files are hosted on GitHub (we have ~1600 repos!). Since Adafruit publishes open source hardware and software, this works great to share the designs and also get feedback and improvements from the community. Community members can even find bugs or add new features, and submit those back to Adafruit so that everyone can benefit from the effort!
Many open source projects (or projects in general!) have standards and formatting styles to which all submitted code must adhere. The process of submitting bug fixes or new features to an existing GitHub repository often involves creating a pull request. Continuous Integration (CI) enables you to verify on GitHub that incoming code follows these standards. One form of CI is called GitHub Actions.
GitHub Actions is a Continuous Integration / Continuous Delivery (CI/CD) platform that, among many other things, allows you to automate testing and building incoming code. You create workflows that build and test every pull request. When a pull request is submitted, it automatically triggers an Actions run. Actions goes through all of the checks within the workflows. If there are errors, it will fail. If there are no errors, it will pass. Once passing, a maintainer will be able to merge your PR into their project.
As it is, to keep track of the Actions status of a PR, you would need to keep it open in a visible tab in your browser, and check on it periodically to find out where it's at. Not anymore!
You can easily set up a GitHub Actions Status Tower Light to place on your desk. No soldering or wiring is required for this project thanks to a handy USB-powered tower light we stock that works with any/all computers and operating systems. Simply plug in the tower light, run the code on your computer, and you're ready to go!
- It lights up blinking yellow when the Actions run is queued
- It lights up solid yellow once Actions is running
- When it completes, it will beep.
- If it fails, it will light up red along with the beep.
- If it passes, it will light up green along with the beep.
- If it is cancelled, it will blink red along with the beep.
Of course, all these can be configured to your desire! This guide will show you how to set up the tower light, as well as walk you though the code needed to keep track of your Actions status.
There are a few prerequisites for this guide.
The repository you intend to track must have some sort of GitHub Actions workflow enabled on it. The program used in this project uses the GitHub API to access workflow statuses. You can update which workflow file will trigger the light, but you must have at least one enabled.
This guide assumes you have Python installed on your computer, including
pip for installing the required libraries.
It is also assumed that you have a basic understanding of how to run Python programs from your computer.