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

feat: add support for custom pull request template paths #4814

Merged
merged 6 commits into from
Sep 4, 2024

Conversation

ndom91
Copy link
Contributor

@ndom91 ndom91 commented Sep 2, 2024

☕️ Reasoning

  • After a user comment on discord and some research, it turns out that folks put their PR templates at both .github/PULL_REQUEST_TEMPLATE.md and .github/pull_request_template.md about 50/50. There is also technically an option for folks to put their template anywhere under .github/PULL_REQUEST_TEMPLATE/*.md
  • Therefore, adding a settings path for folks to customize which PR template they want to be used.

🧢 Changes

  • The PR template enable boolean and PR template path (new) are now in the project preferences.
  • This section is hidden if the user is not logged into GitHub

📺 Screenshots

image

Copy link

vercel bot commented Sep 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 4, 2024 0:46am

@ndom91 ndom91 force-pushed the feat-add-custom-PR-template-path-settings-field branch from ebe493c to 65482da Compare September 2, 2024 15:25
@mtsgrd
Copy link
Contributor

mtsgrd commented Sep 2, 2024

About the pre-styled message, look for showToast(...) instead of using showError if you want to render it differently!

@ndom91
Copy link
Contributor Author

ndom91 commented Sep 2, 2024

About the pre-styled message, look for showToast(...) instead of using showError if you want to render it differently!

Yeah i tried that initially, but the message still seemed to get rendered into what was displayed as like a <pre /> element.

EDIT: Ahh I see, since the type: 'error' it'll always wrap the content in a <code />. Maybe I'll just make this style: 'neutral' then.

@mtsgrd
Copy link
Contributor

mtsgrd commented Sep 2, 2024

Actually, I was the one confused. I see we use <code> for errors, and markdown formatted content for other content.

@ndom91 ndom91 force-pushed the feat-add-custom-PR-template-path-settings-field branch from e2f3840 to 3856360 Compare September 4, 2024 14:10
@ndom91
Copy link
Contributor Author

ndom91 commented Sep 4, 2024

Much better!

image

I think the neutral is perfectly fine here as we don't really treat this as an error. If we can't find your template we just swallow the octokit.content.get error and continue on creating your PR without a template body, and notify the user with that toast ^^

@ndom91
Copy link
Contributor Author

ndom91 commented Sep 4, 2024

@PavelLaptev pinging you for the UI / copy of this preferences section

What do you think? This is in the project preferences:

image

@ndom91 ndom91 changed the title feat: add initial support for PR Template custom path feat: add support for custom pull request template paths Sep 4, 2024
@ndom91 ndom91 marked this pull request as ready for review September 4, 2024 15:05
@estib-vega
Copy link
Contributor

The code looks good to me 👍

@ndom91 ndom91 force-pushed the feat-add-custom-PR-template-path-settings-field branch from 28519fa to 558d79f Compare September 4, 2024 15:22
Copy link
Contributor

@PavelLaptev PavelLaptev left a comment

Choose a reason for hiding this comment

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

@ndom91 thanks! lgtm

@ndom91 ndom91 merged commit 36e9845 into master Sep 4, 2024
12 checks passed
@ndom91 ndom91 deleted the feat-add-custom-PR-template-path-settings-field branch September 4, 2024 15:25
@koppor
Copy link

koppor commented Sep 7, 2024

  • Therefore, adding a settings path for folks to customize which PR template they want to be used.

i would have expected that Gitbutler auto detects the existance of the template. The paths are pre-determined by GitHub. I think, it are three (times two because of casing). See: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository

I agree, users can specify more in a directory github/PULL_REQUEST_TEMPLATE/. For that, the configuration is nice. I would have expected a drop down in this case.

Reason: GitButler is interacting with GitHub directly, not with arbitrary platforms. Thus, GitButler should make it convenient to interact with GitHub.

@ndom91
Copy link
Contributor Author

ndom91 commented Sep 7, 2024

@koppor thanks for the suggestion, I think if we check the few case-variants and then potentially list hte contents of a .github/PULL_REQUEST_TEMPLATE/ dir (if it exists), then we could easily offer this as a dropdown. I agree that'd be a ncier UX 👍

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

Successfully merging this pull request may close these issues.

5 participants