Skip to content

Commit

Permalink
allow templates in --pr-merge-commit-title & --pr-merge-commit-message (
Browse files Browse the repository at this point in the history
#345)

* allow templates in --pr-merge-commit-title & --pr-merge-commit-message

* lint

---------

Co-authored-by: Vincent Behar <[email protected]>
  • Loading branch information
jashandeep-sohi and vbehar authored Aug 5, 2024
1 parent d546d42 commit 0603017
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions repository/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ func (o *GitHubOptions) setDefaultValues(git GitOptions, tplExecutorFunc templat
}
o.PullRequest.Body = prBody

prMergeCommitTitle, err := tplExecutorFunc(o.PullRequest.Merge.CommitTitle)
if err != nil {
return fmt.Errorf("failed to run template for pull request merge commit title %s: %w", o.PullRequest.Merge.CommitTitle, err)
}
o.PullRequest.Merge.CommitTitle = prMergeCommitTitle

prMergeCommitMessage, err := tplExecutorFunc(o.PullRequest.Merge.CommitMessage)
if err != nil {
return fmt.Errorf("failed to run template for pull request merge commit message %s: %w", o.PullRequest.Merge.CommitMessage, err)
}
o.PullRequest.Merge.CommitMessage = prMergeCommitMessage

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (r Repository) Update(ctx context.Context, updaters []update.Updater, optio
return true, pr, nil
}

err = r.mergePullRequest(ctx, options.GitHub, pr)
err = r.mergePullRequest(ctx, strategy.Options.GitHub, pr)
if err != nil {
return true, pr, fmt.Errorf("failed to merge Pull Request %s: %w", pr.GetHTMLURL(), err)
}
Expand Down

0 comments on commit 0603017

Please sign in to comment.