probot / template

Template for new Probot apps
https://probot.github.io/docs/development/#generating-a-new-app
ISC License
51 stars 165 forks source link

Add Installations Badge for number of installations of App #73

Open abhijeetps opened 6 years ago

abhijeetps commented 6 years ago

I think it would be really cool, if we can add an installation badge in README.md of your application repository. It could look something like this: Installs Badge

How to add this badge in your repository? I am using Dynamic Badge feature provided by Sheilds.io. Using this, one can add dynamic badges to show number of installations of the application.

Here's a template to know installations of your app: https\://img.shields.io/badge/dynamic/json.svg?label={LABEL}&url={DEPLOYMENT-URL}/stats&query={QUERY}&colorB={HEXCODE}&style={SOME-STYLE}

Here's how to configure the badge using above template ☝️

Placeholder Replace with
{LABEL} Install (Or Installations, or whatever name you would like to add)
{DEPLOYMENT-URL} URL where you have deployed your app. (Note: This will only work if you have enabled stats for your app
{QUERY} Uses jsonpath, for probot app, this should be $.installations
{HEX-CODE} Hex code of the color you want (without # symbol)
{SOME-STYLE} One of the Styles provided by Shield.io

Thus, for example, for the Weekly Digest app, the number of installation badge could look something like this: https://img.shields.io/badge/dynamic/json.svg?label=installs&url=https://weekly-digest.glitch.me/probot/stats&query=$.installations&colorB=01B1D7&style=for-the-badge

As @hiimbex suggested that this could be added to Probot template, please let me know where I can add this so that I can open a PR for the same. 😄

itaditya commented 6 years ago

this is really cool :+1: :100:

bkeepers commented 6 years ago

I think this is a really cool idea.

However…It would require knowing the deployment host at the time the app is generated, and I'm guessing most apps wont have that information. So putting it in the template would lead to a lot of broken badges for new Probot apps.

Is there a way we can submit a PR to add the badge as part of the process for listing your app on probot.github.io?

itaditya commented 6 years ago

@bkeepers agree with you. One thing though, there are many apps which are not submitted for listing. So I was thinking if we could have a static probot badge which is included in the template.

itaditya commented 6 years ago

we do have a really cool logo, so building a custom badge for probot won't be that difficult

hiimbex commented 6 years ago

Good point @bkeepers, I was thinking about that too, but we do have some fields we leave like this currently.

So it could look like:

https://img.shields.io/badge/dynamic/json.svg?label=Installations&url={DEPLOYMENT-URL}/stats&query=$.installations&colorB=2196F3&style=for-the-badge

I just filled in all the factors we can decide: like styling, what it says should be consistent across repos. So that really only leaves the deployment url to add in, which I don't think is a terrible state to leave the readme in, but it might also be nice to require a PR to add the badge for the site.

Maybe we could automate the pr to add the badge when someone opens a PR to the site? That could be tricky since people put their badges at different spots in the readme.

In the meantime, we can certainly add it to the Pull request template checklist!

I'll be happy to open a PR over there is we're all satisfied with the colors styling and look of the badge right now. It would be ideal to keep this badge consistent!

I kind of like this style: Github All Releases and I think downloads is in the same vein of installs?

bkeepers commented 6 years ago

but we do have some fields we leave like this currently

I don't think there are currently any fields that don't get filled out when create-probot-app is run, are there?

itaditya commented 6 years ago

background-check is using this now https://github.com/probot/background-check

GitHub
probot/background-check
background-check - A GitHub App built with probot that peforms a "background check" to identify users who have been toxic in the past, and shares their toxic activity in the maintainer’s ...
hiimbex commented 6 years ago

I don't think there are currently any fields that don't get filled out when create-probot-app is run, are there?

Ah you're right. I was just thinking about if you leave fields empty when filling out on the command line. But still good point