pwntester / octo.nvim

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

Add template support #313

Closed pwntester closed 1 year ago

pwntester commented 2 years ago

Describe what this PR does / why we need it

This PR adds support for using templates to create both issues and PRs

Does this pull request fix one issue?

Fixes #304

Describe how you did it

When creating a new issue or PR, Octo will check if the repo has template defined for them and if so will offer to use them using a telescope menu So far, it will create the issue/PR with the basic template, and users need to edit the template after the issue/PR is created which is not ideal.

Describe how to verify it

Special notes for reviews

shivanth commented 2 years ago

I successfully created a pr using a template using this branch. :+1

blakedietz commented 2 years ago

I successfully created a pr using a template using this branch. :+1

Any tips on how I could use packer to switch to this branch temporarily to help with testing?

shivanth commented 2 years ago

Any tips on how I could use packer to switch to this branch temporarily to help with testing?

Use branch key in packerc onfiguration. Example copied from packer readme:

  use {
    'glepnir/galaxyline.nvim', branch = 'main', config = function() require'statusline' end,
    requires = {'kyazdani42/nvim-web-devicons'}
  }
sozoalvin commented 1 year ago

Will this PR be merged soon? Is there anything I can do to help?

pwntester commented 1 year ago

I think its fine to get this merged. Let me know if you find any problems

sozoalvin commented 1 year ago

@pwntester will update octo and try it out - will provide feedback if any! thanks for all that you do

sozoalvin commented 1 year ago

sorry ; how do you create a PR using templates? (i realised you talked about a telescope window opening) do you just run :Octo pr create ? if yes, mine has a little window that slides up and after putting in title , base branch values , comes up with an error:

Screenshot 2022-09-14 at 10 51 39 AM

pwntester commented 1 year ago

Seems like you got nil instead of the template body so for some reason it failed to grab the template for your PRs. Can you share the repo you are using if public or let me know whats the PR template and where its located?

sozoalvin commented 1 year ago

ah; its not a public repo - but i can try to create a public repo with the sample template to see if i can get the same error

just checking, is there should the file sit and be named in such a folder/ directory?

github/PULL_REQUEST_TEMPALTE.MD

pwntester commented 1 year ago

The path looks correct except its missing a leading dot .github/PULL_REQUEST_TEMPLATE.MD

sozoalvin commented 1 year ago

yep it to be exact, the path is indeed as you mentioned. i forgot to type the .

one more thing; i installed octo using vimplug instead of packer; would this have caused isuses?

pwntester commented 1 year ago

No, that shouldnt be a problem. I use a different one and all of them should be doing the same

sozoalvin commented 1 year ago

Dear @pwntester thank you. I think there was something wrong with my installation - having said that I think something is off and there is no longer an error.

But can i just confirm that when you try to create a PR using octo, the inputs for PR title will be via the little box that slides open on the bottom left of nvim ?

(is there an ongoing feature that allows editing via a nvim editor instead?)

P.S. thank you so much for your help

pwntester commented 1 year ago

We use vim.fn.input() which can be "hijacked" by plugins to present the input form in different ways. Without any plugins, you should get the input prompt in the command line. It seems you may be using something like https://github.com/stevearc/dressing.nvim