shields
shields copied to clipboard
GitHub file size for a specific branch
: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.
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)
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) :)
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)
Hi @calebcartwright, This issue can be closed thanks to the https://github.com/badges/shields/pull/8262 having already been merged to master. Thanks :)
Closed in fa3839cdab3a7fc7b15c1cd35b4da175d4e28b07