Skip to content

Commit

Permalink
Fix PreserveTitleAndBody bug
Browse files Browse the repository at this point in the history
Set Title and Body to nil when setting is true

Test on my repository with both value, it works as expected.
  • Loading branch information
Rémy Virin authored and Eitan Joffe committed Aug 12, 2022
1 parent 565965f commit 08062a5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/
.DS_Store
15 changes: 12 additions & 3 deletions github/githubclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,21 @@ func (c *client) UpdatePullRequest(ctx context.Context, gitcmd git.GitInterface,
Interface("PR", pr).Msg("UpdatePullRequest")

body := formatBody(commit, info.PullRequests)
_, err := c.api.UpdatePullRequest(ctx, genclient.UpdatePullRequestInput{
title := &commit.Subject

input := genclient.UpdatePullRequestInput{
PullRequestId: pr.ID,
BaseRefName: &baseRefName,
Title: &commit.Subject,
Title: title,
Body: &body,
})
}

if c.config.User.PreserveTitleAndBody {
input.Title = nil
input.Body = nil
}

_, err := c.api.UpdatePullRequest(ctx, input)

if err != nil {
log.Fatal().
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ User specific configuration is saved to .spr.yml in the user home directory.
| statusBitsHeader | bool | true | show status bits type headers |
| statusBitsEmojis | bool | true | show status bits using fancy emojis |
| createDraftPRs | bool | false | new pull requests are created as draft |
| PreserveTitleAndBody | bool | false | updating pull requests will not overwrite the pr title and body |
| preserveTitleAndBody | bool | false | updating pull requests will not overwrite the pr title and body |

Happy Coding!
-------------
Expand Down

0 comments on commit 08062a5

Please sign in to comment.