octo.nvim icon indicating copy to clipboard operation
octo.nvim copied to clipboard

Add template support

Open pwntester opened this issue 2 years ago • 3 comments

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

pwntester avatar Aug 02 '22 10:08 pwntester

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

shivanth avatar Aug 08 '22 17:08 shivanth

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?

blakedietz avatar Aug 11 '22 20:08 blakedietz

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'}
  }

shivanth avatar Aug 13 '22 15:08 shivanth

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

sozoalvin avatar Sep 12 '22 18:09 sozoalvin

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

pwntester avatar Sep 13 '22 20:09 pwntester

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

sozoalvin avatar Sep 14 '22 02:09 sozoalvin

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

sozoalvin avatar Sep 14 '22 02:09 sozoalvin

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?

pwntester avatar Sep 14 '22 08:09 pwntester

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

sozoalvin avatar Sep 14 '22 18:09 sozoalvin

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

pwntester avatar Sep 14 '22 18:09 pwntester

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?

sozoalvin avatar Sep 15 '22 02:09 sozoalvin

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

pwntester avatar Sep 15 '22 07:09 pwntester

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

sozoalvin avatar Sep 22 '22 09:09 sozoalvin

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

pwntester avatar Sep 22 '22 09:09 pwntester