Badges are often a convenient utility to track the status of a project and if you want to add a badge showing your last build's status, Shippable provides its own api for bagdes. This api always returns default badge which will say run is shippable in case your run was successful.
This is something that you always not want. You may like to have a custom badge of your choice which will display the label and color that you want. For example: You would like to display a badge for a specific branch with the branch name and its status in the badge itself.
This is possible by using shields.io. Shields.io provides an api that will generate a badge with the text of your choice for a given projectId. You will need to pass the projectId and few query parameters to get your own badge.Here is how your url might look like.
https://img.shields.io/shippable/:projectId/:branch.svg?field1=value1&field2=value2&field3=value3
Note You can get the projectId from your project page on shippable.
Following are the various fields that you can use to get your custom badge.
Note: Since
#
is an special character, you need to encode it while passing in the url. To encode it use%23
, for example to pass the color#FF0000
you need to uselabel=%23FF0000
- Below is an example of how you can generate a bagde with label as
My label
, color set to "#000" success label set toSuccess label
" and success color set to#3128C7E
.
URL : https://img.shields.io/shippable/54ee15335ab6cc13528dd1ef.svg?label=My%20label&successLabel=Success%20label&colorA=%23000&successColor=%23128C7E