gh-dash icon indicating copy to clipboard operation
gh-dash copied to clipboard

Add PR approval

Open jgrumboe opened this issue 2 years ago • 16 comments

Is your feature request related to a problem? Please describe. Sometimes when bumping Terraform module versions, I get a bunch of renovate PRs. I would like to quickly approve them from within dash.

Describe the solution you'd like I would like to add "Approve" as a keybinding like "Merge" (https://github.com/dlvhdr/gh-dash/pull/168). Probably it popups with a message dialog to enter a comment.

Describe alternatives you've considered Currently I created my own keybinding.

Additional context I would like to implement it in the context of #hacktoberfest which is just around the corner.

jgrumboe avatar Sep 15 '22 12:09 jgrumboe

cool yeah that's something I definitely want! I didn't implement it yet as I needed to think more on the UX of it. Reviewing a PR with gh pr review needs flags specifying approving/rejecting and a message body. I thought I could implement an generic input mechanism similar to vim's vim.ui.select.

Something like this: image

dlvhdr avatar Sep 15 '22 13:09 dlvhdr

Would it make sense to use something like the modal window from tview (https://github.com/rivo/tview/wiki/Modal) ?

jgrumboe avatar Sep 15 '22 15:09 jgrumboe

I'm not sure that'll work with bubbletea, but if it were to work, do you know how much that'll add to the binary size?

dlvhdr avatar Sep 15 '22 17:09 dlvhdr

No idea. Honestly, I'm more or less a copy/paste "dev" as my background is more Ops than Dev. 🙂

But as said I would like to try a PR for #hacktoberfest. Are you fine with that?

jgrumboe avatar Sep 15 '22 17:09 jgrumboe

Yeah sure, give it a try

dlvhdr avatar Sep 15 '22 17:09 dlvhdr

After a quick search I know now that bubbletea is already a TUI lib 💡 and that https://github.com/erikgeiser/promptkit could be a good fit. I will explore in the bubbles field.

jgrumboe avatar Sep 15 '22 18:09 jgrumboe

Yes check out https://github.com/charmbracelet/bubbles

dlvhdr avatar Sep 15 '22 18:09 dlvhdr

This would be a big help for us since most of our repos require approval before a PR can be merged

rpdelaney avatar Dec 13 '22 20:12 rpdelaney

@dlvhdr

I needed to think more on the UX of it.

Having separate hotkeys for approval and requesting changes would be enough for us. Simple is better than nothing. This is the last feature I need to live in the terminal. :)

rpdelaney avatar Feb 03 '23 16:02 rpdelaney

Got it :) Making someone be able to live in the terminal is definitely a motivator 🥰

dlvhdr avatar Feb 03 '23 16:02 dlvhdr

@rpdelaney but what about reviewing the PR before approving it? You would still need a way to add comments on lines in files. This can be done with octo nvim but if you use it then you can approve the PR through its interface.

dudicoco avatar Dec 07 '23 18:12 dudicoco

@dudicoco Not every PR requires that I add comments.

rpdelaney avatar Dec 07 '23 21:12 rpdelaney

For anyone curious, you can use gh-dash with Gum also from charm to create prompts with input.

Here is how you can do a pr approval with a comment. Can adjust for request changes, text blocks over inputs etc.

keybindings:
  prs:
    - key: a
      command: >
        gh pr review --repo {{.RepoName}} --approve --body "$(gum input --prompt='Approval Comment: ')" {{.PrNumber}}

miniscruff avatar Apr 03 '24 00:04 miniscruff

keybindings:
  prs:
    - key: a
      command: >
        gh pr review --repo {{.RepoName}} --approve

I did not grok that this was possible already in gh-dash. Thank you so much.

rpdelaney avatar Apr 03 '24 13:04 rpdelaney

Figured this out today, but left me with a quick question—is there a way to adjust the ? help text? Asking because inevitably I'll need to check my own config several times before I "learn" my own key bindings 😂 It would be nice to be able to see my updated key binding in the help text.

adamtaylor13 avatar May 28 '24 17:05 adamtaylor13

That sounds like a good topic for a separate issue

rpdelaney avatar May 28 '24 19:05 rpdelaney