Create a badge by pointing an image markup tag to /:owner/:repo.svg
e.g. /healeycodes/project-mood.svg
. The API works with any public repository.
Git commits are scanned using the GitHub API to create a dynamic badge based off average commit time.
SVGs will have the average commit time as hover text via the inner-SVG tag <title>
.
If I continue working on this, these are the things that will need to be addressed:
- Caching:
- Repositories should be scanned infrequently rather than per request.
- We can store the most recently requested SVGs in memory.
- Basically, don't generate the SVG for every request (which is used for the prototype).
- Blended colors depending on average time rather than fixed colors.
npm i
For running and testing, set GHTOKEN
to your GitHub personal access token, and USERAGENT
to a custom user-agent (required by GitHub).
(Optional) set a port via PORT
-- 8080
by default.
npm start
This repo uses Travis CI which currently builds and tests for commits/branches/PRs
The test framework is Mocha/SuperTest.
Set NODE_ENV
to test
.
npm test
GET /healeycodes/project-mood
β responds with an SVG (586ms)
GET /healeycodes/missing-or-mispelled-project
β responds with the default errored SVG (395ms)