badges / shields

Concise, consistent, and legible badges in SVG and raster format
https://shields.io
Creative Commons Zero v1.0 Universal
23.45k stars 5.49k forks source link

Parse GitHub URL to create Travis badge #2420

Open techtonik opened 5 years ago

techtonik commented 5 years ago

This is the current form for Travis CI badge.

image

And editing it to point to Travis CI is cumbersome. It will be more intuitive if the interface could parse the link automatically. I am willing to do this, but I need some guidance as I don't know React at all, and a pointer to the place of the code where I can change this behavior.

techtonik commented 5 years ago

Legacy service?

https://github.com/badges/shields/blob/97139648129eaed8293307a0d175160f98786aba/services/travis/travis-build.service.js#L3

Is there a porting guide to "new" kind of services that can be pointed to from https://github.com/badges/shields/blob/master/services/legacy-service.js ?

paulmelnikow commented 5 years ago

Is there a porting guide to "new" kind of services that can be pointed to from https://github.com/badges/shields/blob/master/services/legacy-service.js ?

There is now! https://github.com/badges/shields/blob/master/doc/rewriting-services.md

paulmelnikow commented 5 years ago

Hi! If I understand this request correctly, it's a refinement of #701. Rather than individual fields, there would be a place to paste the GitHub URL. Nice idea!

Also worth doing, and easier to tackle quickly, is to add Travis to the badge suggestions. That would be done in the suggestion API. The way a user would access it is by pasting a github URL into the search/suggest box and clicking Suggest Badges. This is momentarily blocked on #2441 which is modifying that endpoint, though you could grab that branch and start playing with the suggest feature if you'd like.

There's a bunch of work underway for the general case (#701) which I think needs to land first. Then there probably needs to be a flag in the service definition for services whose URLs can be inferred from a GitHub URL, and new some code in the front end to do that.

I'd suggest reading #2441 as a good place to start. Feel free to post comments and questions.

techtonik commented 5 years ago

Looks like Suggest Badges is broken on FF. If I paste https://github.com/badges/shields/ no suggestions are proposed.

Still trying to get the time for React.

paulmelnikow commented 5 years ago

Fixed in #2604.

techtonik commented 5 years ago

I still have no idea how

image

maps to https://github.com/badges/shields/blob/master/services/travis/travis-build.service.js

Inspecting element doesn't help, because it is generated HTML.

paulmelnikow commented 5 years ago

Would be nice to include a link to the source code! You could open a new issue for that if you like.