I recently enjoyed a nice holiday (see the beautiful cover photo) and that gave me some fresh ideas to challenge myself to build something new. That’s how I came up with the idea to challenge myself to build Github Actions and also in a language (Typescript) in which I have not worked much yet.
Toolkit
Both projects I created have a dev toolkit which makes future development a bit easier.
- Typescript the main code language and for strict typing
- Prettier as code formatter
- Jest for testing the code with code coverage
- Vercel/ncc for compiling the code into a single file
- Husky (pre-commit) to make sure we don’t forget anything during git commits
PR Labels Checker
One of the first projects that emerged from this is an action that checks whether an (in)valid label is present in your pull request. If there is no valid label present, the CI will break and you will know that something is wrong.
There are plenty of these available in the marketplace, but in terms of scope it is suitable to gain some experience in how to create a GitHub action, without immediately wanting to do very complex things.
Inactivity Lock
The second project is to close inactive pull requests or issues after a (self-set) number of days, with a reason for locking. I spent quite some time on this and completely rewrote the code several times, because I wanted to solve a problem with the old GitHub action that I used before.
In the old situation I received dozens of emails every day from GitHub actions that failed due to a secondary rate limit. I wanted to get rid of this and that triggered me to build my own GitHub action that uses a different API (graphql), with more calls per hour (5000) and that retrieves exactly the right list of issues/pull requests.