Snyk badge generator for private GitHub repositories.
As of August 2019, Snyk badges currently only work for public npm packages and GitHub repositories, and will fail if pointed at a private repository. This Go app aims to solve that problem by providing badges for private repositories.
NOTE: Will only work for repositories you have integrated in Snyk.
- Integrate Snyk with your GitHub account
- Install Go
- Set environment variables
SNYK_ORG_ID="Your Snyk Organisation ID" SNYK_API_KEY="Your Snyk API key"
- Run
go build snyk.go && ./snyk
- Visit http://localhost:8080/badge/{username}/{repo_name}/ (Replace
{username}
and{repo_name}
with your own GitHub username and the private repository you have access to, respectively)
Note: Trailing /
is mandatory.
Note: Directory api/
is for serverless deployment on now.sh
Hits the List All Projects API and gets a list of all the projects in your organisation. Searches for the repo you mentioned in the URL and counts the number of issues in it. If the number of issues is 0, gives a green badge. If more than 0, gives a red badge with the total number of issues as the value. If access unavailable gives a grey badge.
Badges are generated with the help of the awesome Shields project. Badges look like