Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAllow choosing a blank issue/pr template #950
Conversation
2de508f
to
e8741b9
e8741b9
to
6effcd4
|
In testing this I noticed our bug fix template has no name (not an issue when we weren't previously displaying it in a select menu); I pushed a commit to give it a name. |
I had also noticed that, and was going to point it out, but then I think it slipped my mind |
dd4924c
to
bd7790f
|
This looks good to me, but I wonder whether we're still keeping parity with dotcom here. When opening issues in web UI, users only get presented with a template picker + "open a blank issue" option when there are When opening pull requests in web UI, users never get presented with a template picker (as far as I know?), but users can pick a template by passing a But if we wanted to match what dotcom is doing, then |
Right. Seems the right way to go. |
|
Yes, please amend this PR! Thank you |
8fe22e9
to
01f272d
| @@ -10,8 +10,8 @@ import ( | |||
| "gopkg.in/yaml.v3" | |||
| ) | |||
|
|
|||
| // Find returns the list of template file paths | |||
| func Find(rootDir string, name string) []string { | |||
| // FindNonLegacy returns the list of template file paths from the template folder (according to the "upgraded multiple template builder") | |||
This comment has been minimized.
This comment has been minimized.
AliabbasMerchant
May 22, 2020
Author
GitHub refers to the original way of PULL_REQUEST_TEMPLATE.md and ISSUE_TEMPLATE.md files as 'legacy' and the new method of PULL_REQUEST_TEMPLATE and ISSUE_TEMPLATE folders containing the template files as "upgraded multiple template builder".
I have hence called them as legacy and nonlegacy
| @@ -397,7 +397,7 @@ func issueCreate(cmd *cobra.Command, args []string) error { | |||
| url.QueryEscape(title), | |||
| url.QueryEscape(body), | |||
| ) | |||
| } else if len(templateFiles) > 1 { | |||
| } else if len(nonLegacyTemplateFiles) > 1 { | |||
This comment has been minimized.
This comment has been minimized.
AliabbasMerchant
May 22, 2020
Author
The /choose route is to be opened only if we have non-legacy templates. If there is a legacy template only, it is selected by default by GitHub
|
@AliabbasMerchant Thanks for the updates! Note for the future: it's easier for us to go through review cycles if you refrain from force-pushing the branch. In general, we avoid force-pushing while multiple people are either working on or reviewing a branch. After a force-push, it's hard for us to tell exactly which code is new since last review. When the PR is approved to merge, we can always clean up the history by doing a rebase before the big merge. |
9c6103c
to
4fd051b
| const ( | ||
| issueMetadata metadataStateType = iota | ||
| prMetadata | ||
| ) | ||
|
|
||
| type issueMetadataState struct { |
This comment has been minimized.
This comment has been minimized.
AliabbasMerchant
May 22, 2020
Author
I feel that the name of this struct should be changed, since it is not only used for issues, but for PRs also.
Possibly to metadataState?
This comment has been minimized.
This comment has been minimized.
mislav
May 22, 2020
Member
In github-y terms, PRs are issues since they are a subset of Issues. If we renamed this to metadataState in the command package then it might not be clear what the "metadata" applies to. I think the only more precise name would be "issueOrPullRequestMetadataState`
This comment has been minimized.
This comment has been minimized.
AliabbasMerchant
May 22, 2020
Author
In github-y terms, PRs are issues since they are a subset of Issues
Oh. I didn't know that.
I think the only more precise name would be "issueOrPullRequestMetadataState`
Agreed. Can we do that, just for extra clarity?
|
@mislav Right, sorry. I won't force push from now on. Will clean up the history only after the PR is approved. |
|
In accordance with @mislav 's suggestion, the new workflow is as follows:
When the NonLegacyTemplates are present, the user is given a prompt to choose from them and a blank template(which defaults to the LegacyTemplate, if it is there, or an empty body) There are currently no tests for template selection, but @vilmibm and I working on them in #986 |
|
Code looks good to me! I will need until next week to manually test to verify behavior, and perhaps I would shuffle some code around, but for now I don't have specific suggestions. Thank you for your hard work! |
| @@ -116,7 +224,7 @@ func TestFind(t *testing.T) { | |||
| file.Close() | |||
| } | |||
|
|
|||
| if got := Find(tt.args.rootDir, tt.args.name); !reflect.DeepEqual(got, tt.want) { | |||
| if got := FindLegacy(tt.args.rootDir, tt.args.name); *got != tt.want { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
AliabbasMerchant
May 22, 2020
•
Author
Coz tt.want is just a string now, since we only have at most a since legacy template file
| const ( | ||
| issueMetadata metadataStateType = iota | ||
| prMetadata | ||
| ) | ||
|
|
||
| type issueMetadataState struct { |
This comment has been minimized.
This comment has been minimized.
mislav
May 22, 2020
Member
In github-y terms, PRs are issues since they are a subset of Issues. If we renamed this to metadataState in the command package then it might not be clear what the "metadata" applies to. I think the only more precise name would be "issueOrPullRequestMetadataState`
|
@mislav Did you get the chance to test this out? |


AliabbasMerchant commentedMay 17, 2020
Fixes #504