Enhancement/new script request: "Github-Releases?"
See original GitHub issueHey Rob!
So I spent some time digging through the darned GH site code (my head hurts now) and after taking your rawlinks script as a guide (JS not my primary lang) began and fairly quickly now feeling defeated on one of those things I’ve been putting off it seems forever that seems to still be missing from any available GH enhancements out there.
From talking to others I know I’m not the only one that frequently (despite yes, using official Git) either prior to deciding to do an official local clone to work on, or simply for backup/analysis of my or some other repo, utilizing the GH web Clone or Download \ Download Zip
button. Be it on different branches, etc.
So, now to where I had always felt there was room for a “wouldn’t that be cool” that over the years has become “I’m really tired of having to…” is:
-
Clicking on the
Download Zip
enhanced to append thecommit-tease-sha
(short-sha) element text at the end of the target filename. Today, re-saving the repo only results in"Repo-master(1).zip","Repo-master(2).zip"
so what an excellent idea to instead, through userscript magic, make it automatically save/suggest as"Repo-master(07f668c)","Repo-master(210f04)"
since personally, that is now what I wind up having to do by hand to better identify the downloaded version(s).
This itself introduces a challenge I had not considered until diving in - when you look at the HREF the zip is named based on the branch (master.zip
/develop.zip
/etc.) however is really only a fallback because the header returned hands the browser (if it’s listening) theContent-Disposition: attachment
header at which time the browser suggests/defaults to in GH case:<reponame>-<branchname>.zip
. This is why if you do a standard wget or curl you getmaster-zip
, and if you open Chrome and click you getRepo-master.zip
. So, there is that challenge to deal with and I have seen decent examples of utilizing the header inXMLHttpRequest()
, but still hitting a brick wall at the design phase as to the best approach. -
Clicking on the same
Download Zip
also enhanced to appending 3 new list elements below the (hopefully enhanced) ZIP file download button. Perform an API lookahead (this is where the rawlinks I thought could be helpful since I eventually realized it needs to do basically the exact same thing you did there but in repo/releases) to the releases page, pull UP TO the first three (3) most recent (let’s say strictly the ZIP files for simplicity). I did come up with nice jquery code right before it occurred I should instead be using the API and I had totally wasted my time 😦.
I really really cannot believe nobody has written even just the releases one since the binary releases are so commonly downloaded and most are only interested in the more current and want to perhaps see the comparison to the prior release for possible rollback. If this is perhaps something you would ever want to work on I will certainly share the (apparently little) I have determined (I have narrowed down I believe some of the key element selector/paths etc.). I just recall when we discussed the rawlinks how fast you churned that out, and being that much of these two enhancements (I think) is already just perhaps a regurgitation/rework of that same script maybe you’d look and think this would be just as easy for you. 😃
TIA!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:15 (13 by maintainers)
Top GitHub Comments
Please test out the script - https://github.com/Mottie/GitHub-userscripts/wiki/GitHub-download-zip
Finally added!