Skip to content

Add Github CHERRY_PICK pull request template #300

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

Merged
merged 3 commits into from
Jun 14, 2022

Conversation

Kyle-Ye
Copy link
Contributor

@Kyle-Ye Kyle-Ye commented Jun 14, 2022

Bug/issue #, if applicable:

Summary

  • Add Github CHERRY_PICK pull request template
  • Update gitignore file

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

@swift-ci please test

@Kyle-Ye Kyle-Ye requested a review from franklinsch June 14, 2022 12:14
Co-authored-by: Franklin Schrans <[email protected]>
@Kyle-Ye Kyle-Ye requested a review from franklinsch June 14, 2022 12:46
Copy link
Contributor

@franklinsch franklinsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Kyle-Ye!

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

@swift-ci please test and merge

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

@swift-ci please test

@Kyle-Ye Kyle-Ye merged commit 140ef87 into swiftlang:main Jun 14, 2022
@Kyle-Ye Kyle-Ye deleted the github-pull branch June 14, 2022 13:00
@franklinsch
Copy link
Contributor

@Kyle-Ye Hmm I'm not seeing the template options when creating a PR, any ideas?

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

  1. You can see it via Github's CLI tool (gh pr create) https://cli.github.com

image

  1. Use ?template=xx, eg. https://github.com/apple/swift-docc/compare/main...Kyle-Ye:async-benchmark?template=CHERRY_PICK.md
    See more info here https://github.blog/2018-01-25-multiple-issue-and-pull-request-templates/

@franklinsch

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

Unfortunately there is not a GUI list like Github issue for us to choose when create a Pull Request on Github website.

@franklinsch
Copy link
Contributor

Ooh I see, that's too bad. I think in that case I prefer the previous behaviour where you get just the default template; the point was that you have something to fill in if you're filing a new PR. What do you think? Should we revert the change?

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

Ooh I see, that's too bad. I think in that case I prefer the previous behaviour where you get just the default template; the point was that you have something to fill in if you're filing a new PR. What do you think? Should we revert the change?

I think there should be something that we can configure the default template file like .github/ISSUE_TEMPLATE/config.yml. Let me investigate for some time.

@franklinsch
Copy link
Contributor

Ok, if that'll take some time, should we revert the change for now and if the config file works, re-introduce the templates with the extra file?

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

There are many people encountering the same problem. Here is a solution

https://github.community/t/is-there-a-pull-request-template-selector-similar-to-issues/171838/9

If you accept, we can move DEFAULT.md to its original location and name. Then the default behavior will come back

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

Looking into this a little more, I realized there’s a way to have a default template, as well as additional templates. The default template is stored directly into the .github folder and called PULL_REQUEST_TEMPLATE.MD. We have an additional PULL_REQUEST_TEMPLATES folder containing additional templates that can be used.

Back in 2014 / 2015, using the template query-param was the original way to access templated issues. Since then we got the issues/new/choose endpoint for issue templates and then we got yml forms 3 but pull request templates are still using the old, old way.

@franklinsch
Copy link
Contributor

franklinsch commented Jun 14, 2022

I think let's revert to the original single template, but add a commented out section at the bottom with the template with the cherry-pick instructions:

## Checklist<!--

Note: If this PR cherry-picks a change for a release branch, use the following template instead:

- **Explanation**: _A description of the issue being fixed or enhancement being made. This can be brief, but it should be clear._
- **Scope**: _An assessment of the impact/importance of the change. For example, is the change a source-breaking language change, etc._
- **GitHub Issue**: _The issue number if the change fixes/implements an issue/enhancement on [GitHub Issues](https://github.com/apple/swift-docc/issues)._
- **Risk**: _What is the (specific) risk to the release for taking this change?_
- **Testing**: _What specific testing has been done or needs to be done to further validate any impact of this change?_
- **Reviewer**: _One or more code owners for the impacted components should review the change. Technical review can be delegated by a code owner or otherwise requested as deemed appropriate or useful._

-->

What do you think? That seems to be the cleanest solution.

@Kyle-Ye Kyle-Ye mentioned this pull request Jun 14, 2022
3 tasks
@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

Revert the PR now is totally OK. But I disagree with the approach you describe.

Github has multi PR template feature supported. If we have a need for it, we should follow the Github's official spec instead of using textual form to workaround which seems error-prone for me.

  1. On ph Github CLI, we can choose different PR template in terminal
  2. On Github's website, we can only use the oldest query-param way to choose it.

Back in 2014 / 2015, using the template query-param was the original way to access templated issues. Since then we got the issues/new/choose endpoint for issue templates and then we got yml forms 3 but pull request templates are still using the old, old way.

If we want to revert to the original behevior, we can move the DEFAULT.md to its original location. Then when creating a PR on Github's website, it will use it as the default template.

And also I think we should still put the extra template on PULL_REQUEST_TEMPLATES folder for the following reasons:

  1. We have gh CLI to utilize it
  2. Eventually I believe Github website will support it like issues. And since we are following the spec, no change is needed. We get it free.

@franklinsch
Copy link
Contributor

We still lose discoverability of the cherry-pick template though, at least on the web, and for now. Maybe we can do something in the middle as well, where the comment I'm proposing to add at the bottom can instead refer to the other template:

<!--

If you're opening a PR to cherry-pick a change for a release branch, use this template instead:
https://github.com/apple/swift-docc/blob/main/.github/PULL_REQUEST_TEMPLATE/CHERRY_PICK.md

-->

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

We still lose discoverability of the cherry-pick template though, at least on the web, and for now. Maybe we can do something in the middle as well, where the comment I'm proposing to add at the bottom can instead refer to the other template:

<!--

If you're opening a PR to cherry-pick a change for a release branch, use this template instead:
https://github.com/apple/swift-docc/blob/main/.github/PULL_REQUEST_TEMPLATE/CHERRY_PICK.md

-->

Update #301, could you help review it?

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Jun 14, 2022

Back in 2014 / 2015, using the template query-param was the original way to access templated issues. Since then we got the issues/new/choose endpoint for issue templates and then we got yml forms 3 but pull request templates are still using the old, old way.

By the way, there is a PR #232 to update the issue template to the latest yaml form so that we can fill in issues more easily(In a GUI friendly way).

Context:
v1: accept query params for specfying template
v2: a GUI list chooser to choose different template
v3: GUI composer(md template-> yml template)
Github Issue currently supports v3 for public repo and v2 for all repo. But Pull Request is still at v1

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

Successfully merging this pull request may close these issues.

2 participants