Stephan van Rooij

Software architect with a passion for home automation.

Fork proof actions

F

Github actions are a great tool to setup automatic build and tests. I also use it for any of my automatic releases. See this post. Until now there was one thing missing. If someone would fork the repository, all builds would fail because of missing secrets needed for the release.

Yesterday I released my first github action, it allows you to check if certain secrets are set, and then decide to continue yourself. Or skip specific steps, this functionallity seemed to be missing from the actions marketplace. So now yoou can check the existens of certain secrets (or other inputs), and decide to either have the actioon run fail or just continue and skip some steps.

Screenshot action result

Fail fast

If the secrets should contain credentials for a mandatory service, this action allows you to fail fast. Before even trying to send them to some external service. It will also show a nice warning what is missing, that should make it clear to everyone why some action is failing.

Building an action

Building this new github action was really easy. Github has some nice documentation about it. You can do it either as a docker container (which can run any kind of script) or as a node script.

So if you feel something is missing from the github actions. Just build it yourself! REally easy and can help a lot of people.

Clone a BIG git repository

C

Wanted to clone a repository to do a quick text fix and create a pull request. Created the fork, and tried to clone. Cloning the repository took way longer than I’m used to.

Slow git clone

Github Actions: Use secret file

G

Github Actions are great for automating tests and builds, among other things. If you need a secret (key/token/password), you can add those in the configuration and use them in your workflow.

Sometimes you need a file that is meant to be secret inside your workflow. This post shows you how to securely save this file as a secret and recreate the file during build. We use base64 encoding for a way to convert any file to a string that can be saved in the secrets.

This is all done in powershell core, which is available in all (Windows/Mac/Linux) runners on Github. The code below should work on any platform, but is only tested on a windows-latest runner.

Github pages (Jekyll) live reload with docker

G

I really like Github Pages to host static webpages. Static in this case means the files are generated at build time (so once when you publish a new version), instead of every time like with a wordpress website. One of the main benefits is that it results in a blazing fast website.

Like what you're seeing? Consider Sharing on Twitter or Sponsoring me