How to add badges to a GitHub repository

github wallpaper

In this article, I will show how to add badges to a GitHub repository using shields.io. This application is a web service that can be used to generate concise, consistent, and legible badges in SVG.

Adding badges to the readme file of GitHub repositories is a common task for almost every new repository. These badges help in increasing the readability of the readme file because they provide some KPIs or metrics about the repositories. As a result, readers get a clear idea of the repository very quickly by scanning the attached badges.

The badges that can be added to the repositories cover several topics and areas, starting from the license of the project to the open issues count for the project.

License

You can generate a license badge for your GitHub repository by using the following link. From here, you can select where your repository is, for example GitHub.

Shields.io Licence badge - How to add badges to a GitHub repository
Shields.io Licence badge

Then, open the GitHub link and fill your repository information, as shown in the image below. In this example, I type my GitHub account and the repository from where I want to display the licence that is BlazorChartJs (see more about this Blazor component in this post).

Shield.io GitHub Licence - How to add badges to a GitHub repository
Shield.io GitHub Licence

Version

In case your repository is for a NPM or other libraries, you can add a badge with the version of the package by using the following link. The most interesting options are:

  • Github release: We can generate a version badge based on the repository releases.
  • Gem: We can create a version badge for a given Ruby gem.

The images below show how we can customize these badges for both options.

Shields.io GitHub release - How to add badges to a GitHub repository
Shields.io GitHub release

fury.io is an alternative for generating the version badges for your repository.

Build Status

Build status badges can tell us the last build status of the project. There are several options in this category. Depending on your project type and the tools used for CI/CD pipelines, you can choose one of the available options. Some of the most used badges are Github workfolw StatusJenkinsTracis ci , and CircleCI . Badges for all these CI/CD tools can be added from this link.

Conclusion

In conclusion, this is how to add badges to a GitHub repository. Badges can improve the readability of a GitHub repository because they provide the users with a quick way to collect metrics about the repository.

The aforementioned badges are not the only ones that you can include in your repositories. There are a lot of other badges that could be more applicable to your project, such as Github issues, Coveralls github, Jenkins Coverage, Docker Build Status, and many more. You can check all of these out on shields.io or badgen.net.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.