This repo contains 2 simple GitHub Actions workflows that compute the short hash for a given branch and generate a badge with it. This is useful to quickly check what branch is currently deployed. To make it more realistic, the repo has 3 branches (master, canary and production) with some sample data to make the hashes different.
Credit on schneegans/dynamic-badges-action for most of the logic.
Once computed, the hashes are hosted in this public gist. This is necessary because if we tried hosting in the same repo, the badge would not work for private repos (and we probably don't want to distribute access tokens everywhere).
To include this in your repo:
- Generate a personal access token with access to gists under profile/developer settings
- Create an action secret in your repo called
GIST_SECRET
with that token - Copy the workflow
Credit on emibcn/badge-action for most of the logic. For this option, the SVGs are stored in a branch in the same repo. This makes it more suitable for private repos with security concerns.
To include this in your repo:
- Create an empty orphan branch called
shields-badges
- Copy the workflow