Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

GitHub Action Badges

If you want to show the GitHub Actions status badge for one of your workflow, be aware that the URL has to reflect the action.

An GitHub action configuration file located in:

  • .github/workflow/markdownlint.yml

Could be reflected in a badge with the URL:

  • ![example workflow](https://github.com/jonasbn/til/actions/workflows/markdownlint.yml/badge.svg)

Like for example this badge for one of my repositories:

Markdownlint status badge

  1. The URL points to GitHub: https://github.com
  2. My account: jonasbn
  3. The relevant (this) repository: til
  4. The workflows directory: workflows and this is the workflows directory located in the directory .github, you do however have to add actions before the workflows
  5. Then add action configuration file: markdownlint.yml
  6. And finally add the filename: badge.svg

Complete example:

  • ![example workflow](https://github.com/jonasbn/til/actions/workflows/markdownlint.yml/badge.svg)

If you then want to link the badge to the workflow, you can add the URL to the badge, like this:

  • [![example workflow](https://github.com/jonasbn/til/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/jonasbn/til/actions/workflows/markdownlint.yml)

example workflow and this should now be a clickable link.

Do yourself the favor of testing the URL to the image and to the resource you are linking to before making commits containing it, it took me several attempts to get right.

Thanks to the friendly supporter from GitHub who helped me out.