cli icon indicating copy to clipboard operation
cli copied to clipboard

Add the ability to checkout the latest release using `gh release checkout`

Open Wazbat opened this issue 2 years ago • 3 comments

Describe the feature or problem you’d like to solve

We're using github codespaces to host and run utilities, often used by non-technical team members. If a user has a codespace created, we want to make sure they're using the latest release, instead of the main branch.

The gh release view command already shows the user to view the latest release if ran with no more arguments

Proposed solution

A new command to checkout the tag/commit associated with a specific release. Similar to gh pr checkout, this command would behave the same as gh release view, and check out a provided tag, or the latest tag if none is provided. It would also include the same flags as the other checkout commands like --force --recurse-submodules etc

Examples

gh release checkout
gh release checkout v1.0.2

Wazbat avatar Aug 22 '22 20:08 Wazbat

I understand this could be done relatively easily using a bit of bash-fu.

A simple gh release view --json tagName -t '{{.tagName}}' to get the tag, then simply use git to directly checkout that tag, but I feel it'd be a good addition to the GitHub CLI

Wazbat avatar Aug 22 '22 20:08 Wazbat

this makes sense to me and I'd welcome a PR.

vilmibm avatar Aug 24 '22 19:08 vilmibm

I'm tempted to give it a try myself, though I'm rather inexperienced with go

It is just replicating the same logic as other commands though, so maybe it'd make a good learning experience. I can try

Wazbat avatar Aug 25 '22 08:08 Wazbat

Hey @vilmibm is the goal to do something like gh repo clone? If so, should we do a something like a depth 1 clone?

In other words, is the goal of this command to just get the source of the specific release on the system?

ffalor avatar Jun 18 '23 06:06 ffalor