pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.24k stars 124 forks source link

feat: open PR for current branch with :Octo pr #533

Closed GuillaumeLagrange closed 2 months ago

GuillaumeLagrange commented 2 months ago

Describe what this PR does / why we need it

When calling :Octo pr without further argument, open the pr associated with the current branch

Does this pull request fix one issue?

Fixes #492

Describe how you did it

Add a __call property to the command metatable, to allow command to be called without action arguments Use gh pr view instead of gh pr status to get pr info since it defaults to current branch pr

Describe how to verify it

Checkout a branch in with an open PR in a repo, run :Octo pr

Special notes for reviews

I realized when opening the PR that when the PR is cross repo, the gh cli does not give you the owner of the target repo, so I had to manually parse the url which is quite painful to do in lua. Let me know if there is something smarter to do, either for parsing or with another query for the graphql.

Since we get the pr id from the gh pr view, maybe we could retrieve the repo owner/name info through the graphql request done just after?

pwntester commented 2 months ago

Thanks @GuillaumeLagrange and sorry for the late review! looks good to me as is