Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 282
rodiwa Avatar asked Jun 14 '18 15:06

rodiwa


Video Answer


1 Answers

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:

TravisTravis 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:

TravisTravis

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:

  • Travis branch: https://img.shields.io/travis/73VW/TechnicalReport.svg?style=plastic&label=Custom+Label

  • Travis branch : https://img.shields.io/travis/73VW/TechnicalReport.svg?style=flat-square&label=Custom+Label

  • Travis branch : https://img.shields.io/travis/73VW/TechnicalReport.svg?style=for-the-badge&label=Custom+Label

  • Travis branch : https://img.shields.io/travis/73VW/TechnicalReport.svg?style=social&label=Custom+Label

Have fun!

like image 97
Maël Pedretti Avatar answered Nov 03 '22 21:11

Maël Pedretti