Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hub pull-request should show organization-wide template #2367

Open
nikolaik opened this issue Nov 19, 2019 · 3 comments
Open

hub pull-request should show organization-wide template #2367

nikolaik opened this issue Nov 19, 2019 · 3 comments

Comments

@nikolaik
Copy link

@nikolaik nikolaik commented Nov 19, 2019

Command attempted:
Ran hub pull-request to create a new PR in a repository belonging to a specific organization.

What happened:
Did not fetch the organization-wide PULL_REQUEST_TEMPLATE.md from repo named .github repo and use as pull request description. Instead used a blank description.

More info:
Steps to reproduce:

  • Create an organization with a repository named .github
  • Add a file PULL_REQUEST_TEMPLATE.md with some content
  • In another repository in the same organization as you created the .github repo, checkout a new branch, change some stuff, make a commit and push the branch to github.
  • run hub pull-request
@nikolaik nikolaik added the bug label Nov 19, 2019
@mislav
Copy link
Member

@mislav mislav commented Nov 20, 2019

Thank you for reporting this! We do not yet have support for per-organization issue nor pull request templates. I'm going to re-label this as "feature", but I can also see how you can perceive it as a bug.

@mislav mislav added feature pull-request and removed bug labels Nov 20, 2019
@nikolaik
Copy link
Author

@nikolaik nikolaik commented Nov 20, 2019

Thanks for replying so quickly. I am considering trying to do a PR on this, how would you start?

@mislav
Copy link
Member

@mislav mislav commented Nov 20, 2019

Here is where the pull-request command reads repo templates from disk:

template, _ := github.ReadTemplate(github.PullRequestTemplate, workdir)
if template != "" {
message = message + "\n\n\n" + template
}

You would need to add a condition that, in case a template isn't found in this repo, fetches the templates from the ORG/.github repo. The precise way of doing that would be up to you to figure out. To my knowledge, there isn't a GitHub API to read repo templates.

I have doubts about this functionality. Fetching per-org repo templates will add an additional overhead for every repo that doesn't have its own templates, slowing down the time since pull-request was run to when a text editor opens for authoring PR title & message. Also it looks like it will add complexity to the code and long-term maintenance overhead, and I'm not sure how useful the feature will be in the first place.

You may take a stab implementing this, but keep in mind all these considerations and that the feature won't necessarily make it into a release considering the trade-offs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.