Skip to content

samkit-jain/snyk-badge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

snyk-badge

License: MIT Codacy Badge

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.

Setup

  1. Integrate Snyk with your GitHub account
  2. Install Go
  3. Set environment variables
    SNYK_ORG_ID="Your Snyk Organisation ID"
    SNYK_API_KEY="Your Snyk API key"
    
  4. Run go build snyk.go && ./snyk
  5. 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

How it works

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.

Badge generation

Badges are generated with the help of the awesome Shields project. Badges look like

  • no vulnerabilities
  • 10 vulnerabilities
  • vulnerabilities unknown

About

Snyk badge generator for private GitHub repositories

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages