Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update Coveralls badge image to reflect actual coverage percentage?

I use a Coveralls badge on the README and documentation page to display the code coverage for my project. The badge image often displays an out-of-date percentage. Clearing my browser's cache helps, but that often still gets me an out-of-date percentage image as well, although it might be more up-to-date than the previously displayed badge.

For example, at the time of this writing the badge displays the correct percentage, currently at 91%, on the documentation page at readthedocs.io, but the badge on my GitHub README displays 89%.

How can I manually force the badge image to update on the GitHub README, i.e. how to manually pull/force an updated image from Coveralls that shows the correct percentage?

like image 488
James Adams Avatar asked Sep 16 '25 05:09

James Adams


2 Answers

Clearing the browser cache did not work for me.

An answer on GitHub helped:

I was able to fix this issue on my repo by purging GitHub's cached copy of the badge:

$ curl -X PURGE https://camo.githubusercontent.com/4d04abe0044d94fefcf9af2133223....
More detailed info is available here - https://help.github.com/en/articles/about-anonymized-image-urls

Hopefully this saves someone else the frustration I just went through :)
like image 92
Michael Käfer Avatar answered Sep 17 '25 20:09

Michael Käfer


Add a queryString param to the badge image URL, for instance:

<img src="https://coveralls.io/repos/github/spread-the-code/git-commiter-nodejs/badge.svg?branch=master&kill_cache=1"

like image 45
Hervera Avatar answered Sep 17 '25 18:09

Hervera