rodiwa
rodiwa

Reputation: 1770

Custom label for Travis CI badge on github repo

I'm trying to add 2 badges to my github repo readme, so I can see build status of my dev branch and master branch. I was able to add the badges (and they work too) but I'm not able to differentiate between the badge for master or dev.

enter image description here

Is there a way to add custom text something [dev|passing] [master|failing], etc?

Upvotes: 7

Views: 2277

Answers (2)

Maël Pedretti
Maël Pedretti

Reputation: 784

You can use shields.io which provides quite a lot of badges.

They have one for travis and you can specify the left side text of the badge.

As an example for one of my repo:

The normal link:

Build branch : https://img.shields.io/travis/73VW/TechnicalReport/build.svg

Master branch: https://img.shields.io/travis/73VW/TechnicalReport.svg

Renders as:

Travis Travis branch

A bit of custom:

https://img.shields.io/travis/73VW/TechnicalReport/build.svg?label=Whatever+You+Want https://img.shields.io/travis/73VW/TechnicalReport.svg?label=Master

Renders as:

Travis Travis

This works this way: https://img.shields.io/travis/USER/REPO/BRANCH.svg?label=YOURLABEL

Be aware that the branch part is not needed if you want to use master branch.

I Agree this slows down a bit the load of your github (or whatever) page because shields.io is not really fast but this is cool.

And you can also change badge style:

Have fun!

Upvotes: 12

heldic
heldic

Reputation: 405

I'm afraid this isn't possible at the time. I was looking into this a while ago and stumbled upon this issue, which is still open and unresolved.

Upvotes: 2

Related Questions