shields icon indicating copy to clipboard operation
shields copied to clipboard

GitHub file size for a specific branch

Open mattrossman opened this issue 2 years ago • 4 comments

:clipboard: Description

A version of the GitHub file size service that lets you specify a branch (or other ref value) to read from.

The output would look the same: size | 20 kB

:link: Data

This data is available from the same endpoint as the existing service in github-size.service.js. The branch/tag/commit can be specified via a ref query parameter.

Example: https://api.github.com/repos/badges/shields/contents/index.html?ref=gh-pages

Documentation: https://docs.github.com/en/rest/repos/contents#get-repository-content--parameters

:microphone: Motivation

I deploy build artifacts to a gh-pages branch for hosting on GitHub Pages as part of my CI/CD pipeline. I would like a badge that shows the size of these build artifacts. The current size service only uses the default branch.

mattrossman avatar Apr 22 '22 15:04 mattrossman

Thanks for sharing your idea and including relevant details! I've not read through the specifics of the documentation but sounds straightforward enough and beneficial.

This should be a relatively easy addition for anyone interested in working on it, with the one implementation note being that our badge would need to accept the ref parameter as a query parameter since the route currently ends with a parameter aligning to path to the file within the repo (and both paths and branch-refs can contain slashes)

calebcartwright avatar Apr 30 '22 16:04 calebcartwright

I would like to work on this issue.

@calebcartwright - thanks for your comment, I will make sure that the ref parameter is accepted as a query parameter (as to avoid confusion between the branch/tag/commit reference and the path to the file) :)

PaulaBarszcz avatar Jul 22 '22 21:07 PaulaBarszcz

I would like to work on this issue.

@calebcartwright - thanks for your comment, I will make sure that the ref parameter is accepted as a query parameter (as to avoid confusion between the branch/tag/commit reference and the path to the file) :)

Awesome! Let us know if you have any questions along the way (feel free to open a draft PR to discuss code level things, and/or more general chat, and/or reach out on Discord)

calebcartwright avatar Jul 22 '22 22:07 calebcartwright

Hi @calebcartwright, This issue can be closed thanks to the https://github.com/badges/shields/pull/8262 having already been merged to master. Thanks :)

PaulaBarszcz avatar Aug 08 '22 03:08 PaulaBarszcz

Closed in fa3839cdab3a7fc7b15c1cd35b4da175d4e28b07

calebcartwright avatar Aug 22 '22 20:08 calebcartwright