The GitHub service family is the largest, and as yet untouched by our service rewrite. I thought I would start the process by tackling one service. This pull request has a few things going on: 1. Rename pull-request-status to pull-request-check-state. We have another badge called pull request status. It seems like the checks are called one thing in the UI and another thing in the API, which is unfortunate. If other folks have strong feelings about the name, I’ll defer. 2. Move its tests and tighten up the syntax. 3. Move its badge examples including the doc string. 4. Add a new helper `errorMessagesFor` to use in the new services in place of `githubCheckErrorResponse`. It seems like we didn’t really use the `errorMessages` parameter to `githubCheckErrorResponse`, so I pared this down. I’m not sure if this is the function we’ll ultimately want, but it seems like a good place to start. 5. Pull fetch code I _know_ we use in other places into `github-common-fetch`. As in the PR I just opened for azure-devops, this takes a functional approach to the shared code, which is more direct, nimble, and easy to reason about than inheritance. 6. Create `GithubAuthService` which functions identically to BaseJsonService, except for one thing, which is that it uses the token pool. I accomplished this by adding a `_requestFetcher` property to BaseService, which is initialized to `sendAndCacheRequest` in the constructor, and can be overridden in subclasses. Since we weren’t using `_sendAndCacheRequest` directly except in BaseService and tests, I removed that property. I like this approach to patching in the GitHub auth because it’s very simple and creates no new API exposure. However, the way we’re doing the dependency injection feels a bit odd. Maybe the eventual refactor of request-handler would be a godo time to revisit this. The GitHub requests go through many, many layers of indirection at this point. Later on it would be good to shave some of these off, perhaps once the legacy GitHub services have been converted, or when all the services are done and we can take another look at the base service hierarchy. The work in #2021 and #1205 is also related.
This is home to Shields.io, a service for concise, consistent, and legible badges in SVG and raster format, which can easily be included in GitHub readmes or any other web page. The service supports dozens of continuous integration services, package registries, distributions, app stores, social networks, code coverage services, and code analysis services. Every month it serves over 470 million images.
In addition to hosting the shields.io frontend and server code, this monorepo hosts an NPM library for generating badges, and the badge design specification.
Examples
- code coverage percentage:
- stable release version:
- package manager release:
- status of third-party dependencies:
- static code analysis grade:
- SemVer version observance:
- amount of Liberapay donations per week:
- Python package downloads:
- Chrome Web Store extension rating:
- Uptime Robot percentage:
Make your own badges!
(Quick example: https://img.shields.io/badge/left-right-f39f37.svg)
Browse a complete list of badges.
Contributing
Shields is a community project. We invite your participation through issues and pull requests! You can peruse the contributing guidelines.
When adding or changing a service please add tests.
This project has quite a backlog of suggestions! If you're new to the project, maybe you'd like to open a pull request to address one of them:
You can read a tutorial on how to add a badge.
Using the badge library
npm install -g gh-badges
badge build passed :green .png > mybadge.png
const { BadgeFactory } = require('gh-badges')
const bf = new BadgeFactory({ fontPath: '/path/to/Verdana.ttf' })
const format = {
text: ['build', 'passed'],
colorscheme: 'green',
template: 'flat',
}
const svg = bf.create(format)
View the documentation for gh-badges.
Development
- Install Node 8 or later. You can use the package manager of your choice. Tests need to pass in Node 8 and 9.
- Clone this repository.
- Run
npm installto install the dependencies. - Run
npm run buildto build the frontend. - Run
npm startto start the server. - Open
http://[::]:8080/to view the home page.
To generate the frontend using production cache settings – that is,
badge preview URIs with maxAge – run LONG_CACHE=true npm run build.
To analyze the frontend bundle, run npm install webpack-bundle-analyzer and
then ANALYZE=true npm start.
Snapshot tests ensure we don't inadvertently make changes that affect the
SVG or JSON output. When deliberately changing the output, run
SNAPSHOT_DRY=1 npm run test:js:server to preview changes to the saved
snapshots, and SNAPSHOT_UPDATE=1 npm run test:js:server to update them.
The server can be configured to use Sentry (configuration) and Prometheus (configuration).
Hosting your own server
There is documentation about hosting your own server.
History
b.adge.me was the original website for this service. Heroku back then had a thing which made it hard to use a toplevel domain with it, hence the odd domain. It used code developed in 2013 from a library called gh-badges, both developed by Thaddée Tyl. The project merged with shields.io by making it use the b.adge.me code and closed b.adge.me.
The original badge specification was developed in 2013 by Olivier Lacan. It was inspired by the Travis CI and similar badges (there were a lot fewer, back then). In 2014 Thaddée Tyl redesigned it with help from a Travis CI employee and convinced everyone to switch to it. The old design is what today is called the plastic style; the new one is the flat style.
You can read more about the project's inception, the motivation of the SVG badge specification, and the specification itself.
Project leaders
espadrine is the sysadmin.
These contributors donate time on a consistent basis to help guide and maintain the project:
Related projects
License
All assets and code are under the CC0 LICENSE and in the public domain unless specified otherwise.
The assets in logo/ are trademarks of their respective companies and are
under their terms and license.
Contributors
This project exists thanks to all the people who contribute. [Contribute].
Backers
Thank you to all our backers! 🙏 [Become a backer]
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]