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

Adds support for providing custom PR string template in config #524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

discentem
Copy link
Contributor

@discentem discentem commented Feb 7, 2023

Adds support for providing custom PR string template in config


Stack created with Sapling. Best reviewed with ReviewStack.

$bulleted_list
''')
else:
body = string.Template(template)
Copy link
Contributor Author

@discentem discentem Feb 7, 2023

Choose a reason for hiding this comment

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

This "works" as in doesn't crash at runtime but none of the template variables are injected properly yet. Any ideas what I am doing wrong? Static strings are injected properly.

~/sl/bin/sl pr submit --config pr.template="$commit_msg\n$horizontal_rule\nStack created with [Sapling](https://sapling-scm.com).\n$bulleted_list"

results in

\n\nStack created with [Sapling](https://sapling-scm.com).\n

@@ -48,19 +50,28 @@ def create_pull_request_title_and_body(
owner, name = repository.get_upstream_owner_and_name()
pr = pr_numbers_and_num_commits[pr_numbers_index][0]
reviewstack_url = f"https://reviewstack.dev/{owner}/{name}/pull/{pr}"
if not template:
body = string.Template(f'''
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This default template logic works as expected.

@discentem discentem changed the title PR templates Adds support for providing custom PR string template in config Feb 7, 2023
@facebook-github-bot
Copy link
Contributor

@quark-zju has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@vegerot vegerot left a comment

Choose a reason for hiding this comment

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

Thanks for the patch! I hope eventually we can add two more patches

  1. sl pr submit --edit (or --interactive) that will open your editor to type the PR's body
  2. a config pr.useUpstreamTemplate that when used with sl pr s --edit will prefill the editor with the repo's GitHub PR template (if the repo has a PR template)

@discentem
Copy link
Contributor Author

@ghost
Copy link

ghost commented Oct 25, 2023

Any updates on this, would nice to have

@discentem
Copy link
Contributor Author

discentem commented Oct 25, 2023 via email

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.

3 participants