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

Write SPR messages to a dedicated block inside commit messages #436

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rohan-mehta
Copy link

@rohan-mehta rohan-mehta commented Dec 28, 2024

This fixes #435 (and also #427).

What/why

As noted in the issue, git spr update can overwrite changes made to the PR title/description. To fix this, we can have a dedicated block that looks like this, which the code can search for.

<!-- SPR data start: please do NOT edit this section -->
  
<!-- SPR data end -->

This way, any edits outside of this block are ignored. Since the block uses comments, it visually looks the same as before. And finally, if no block is present (e.g. on first commit or deleted by a user), it appends to the end.

Test plan

I added new test cases. In addition, I ran a manual test which you can see in https://github.com/rohan-mehta/spr-test-repo. The process was:

  1. Create 3 commits, commit_1, commit_2, commit_3, run git spr update, ensure that the spr stack description shows up.
  2. Edit the PR for commit_1 (add stuff above the block) and commit_2 (add stuff above and below the block), then re-run git spr update and ensure that nothing is overwritten.
  3. Amend commit_2, re-run git spr update and ensure that nothing is overwritten.
  4. Create commit_4 at the top of the stack, re-run git spr update and ensure that (a) a new PR is created (b) all previous PRs are updated to show the new commit (c) edits aren't overwritten

@@ -1,4 +1,4 @@

bin:
goreleaser --snapshot --skip-publish --clean
goreleaser --snapshot --skip=publish --clean
Copy link
Author

Choose a reason for hiding this comment

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

The new version of goreleaser changed this flag (See #427)

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.

PR title/body gets overwritten on updates/merges
1 participant