badginator icon indicating copy to clipboard operation
badginator copied to clipboard

Not counting badges at all on a repo

Open breakzplatform opened this issue 9 years ago • 7 comments

Hey @defunctzombie,

badginator is only counting himself at my repo: https://github.com/joselitojunior1/slack-list-brazil. the funny thing is that everything was okay two days ago.

this repo has a lot of badges self-hosted, and badginator is actually very useful on this repo, but for some reason its not working anymore. any ideas?

breakzplatform avatar Feb 05 '16 04:02 breakzplatform

I recently switched to using image analysis to detect badges. Seems that it needs tweaking to properly detect these slack badges. I will take a look at it and see why it isn't working for those badges.

defunctzombie avatar Feb 05 '16 17:02 defunctzombie

Seems there might be an issue with the SVG returned from the urls in some browsers:

If you visit this url in chrome, I get the pretty colored badge but in safari I get the all black badge you see below.

http://braziljs-slack.herokuapp.com/badge.svg

Not sure why this is the case but it is causing issues for badginator because of how it does the image analysis (expecting there to be two colors). We are using svg2png (which uses phantomjs) to do the svg conversion to png and that is suffering from the same problems as safari is when viewing this badge.

Where are these badges coming from? Maybe the code that generates these badges is not generating good cross browser svg images and we could fix that.

defunctzombie avatar Feb 05 '16 17:02 defunctzombie

Looking at the slackin repo I see the following commit:

https://github.com/rauchg/slackin/commit/edcaebce0fb2b4e07ca834a58fa069c53a5e0bf3

While the commit doesn't say what the issue was, it does alter the svg image output and says fix safari so might be good to try updating your slackin if that is indeed what you are using.

I know this is a PITA to update so many deployments so maybe try one first.

Looking at other slackin issues I see this one from a while back: https://github.com/rauchg/slackin/issues/55

And it is exactly what is happening. Doesn't say it was fixed but the last time it was an issue was Sept 2015 and the commit above is Nov 2015 so maybe that was the fix.

defunctzombie avatar Feb 05 '16 17:02 defunctzombie

https://badginator.herokuapp.com/haroenv/holmes.svg also displays 0 while there actually are a whole full 4 badges on https://github.com/haroenv/holmes

Haroenv avatar Aug 10 '16 22:08 Haroenv

@Haroenv the reason it isn't counting correctly for your repo is because the readme is not on the master branch. The logic right now just assumes master branch. Could update it to detect the "default" branch or allow specifying the branch via url.

defunctzombie avatar Aug 14 '16 02:08 defunctzombie

Default branch would seem useful, and probably just changing a url parameter here https://github.com/defunctzombie/badginator/blob/master/index.js#L173

Haroenv avatar Aug 14 '16 06:08 Haroenv

GitHub has an API call for the README: https://developer.github.com/v3/repos/contents/#get-the-readme

Haroenv avatar Aug 14 '16 08:08 Haroenv