← Go back to homepage
How to display GitHub Actions status badge image in your repository’s README.md?

How to display GitHub Actions status badge image in your repository’s README.md?

GitHub actions is one of the latest additions in the sphere of tools, available for CI/CD. It’s quite powerful and integrates directly with the GitHub repository where it’s ran.

One of the benefits of having a CI system, is the ability to quickly understand if your latest build is passing or not. The so called “status badges” help with this, especially for Open Source projects.

Showing such a status badge image in your own repository is quite easy.

You just need to collect 3 pieces of information:

  • Your GitHub organization or username
  • Your GitHub repo’s name (the one visible in the URL)
  • The GitHub Actions workflow name (usually on the first line of /.github/workflows/main.xml

Based on these 3 things, you can construct a URL to an image that’s automatically generated by GitHub actions and represents the latest build status:

https://github.com/<OWNER>/<REPOSITORY>/workflows/<WORKFLOW_FILE_PATH>/badge.svg

To use it inside a repository’s README.md:

![Build passing](https://github.com/<OWNER>/<REPOSITORY>/workflows/<WORKFLOW_FILE_PATH>/badge.svg)
← Go back to homepage