shields icon indicating copy to clipboard operation
shields copied to clipboard

Github actions badge not working on private repo

Open danielgroen opened this issue 2 years ago • 2 comments

Are you experiencing an issue with...

My own instance of shields

🐞 Description

I have a private repo on github.

Also i have my own hosted shields server: https://githubshieldsio.herokuapp.com

This is all set with a PAT token so it should read all the info from the repo.

Now the badge of the workflow can't find the repo. When i set the repo to public, then the badge does work!

🔗 Link to the badge

Example of a badge reading the same repo (but does work) https://githubshieldsio.herokuapp.com/github/package-json/v/danielgroen/affiliate-program

The badge that doesn't work. https://githubshieldsio.herokuapp.com/github/workflow/status/danielgroen/affiliate-program/prod

💡 Possible Solution

No response

danielgroen avatar Sep 14 '22 08:09 danielgroen

See https://github.com/badges/shields/discussions/5676.

LitoMore avatar Sep 19 '22 07:09 LitoMore

Unlike most of our github badges which call an API endpoint, this one is basically a scraper or wrapper for github's own badge that allows you to apply the shields styles/icons/etc to it. You will find that if you call https://github.com/danielgroen/affiliate-program/workflows/prod/badge.svg when you're logged in to github, it works. If you call it when you're not logged in, its a 404. With all our other badges that use the GitHub API, providing a token allows us access to private resources. This badge is an outlier in this respect. If it is possible to use a token in the request (I've not checked), we'd happily take a PR for this but at the moment this specific badge won't work for private repos.

chris48s avatar Sep 20 '22 20:09 chris48s

Going to close this as a duplicate of #4681 in favor of keeping things consolidated under #4587

calebcartwright avatar Sep 25 '22 20:09 calebcartwright