mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-18 18:38:08 -05:00
* Use a secondary template instead * formatting Co-authored-by: Luis (LT) Carbonell <lt.carbonell@hashicorp.com>
This commit is contained in:
parent
1df0fa727e
commit
8daabab539
2 changed files with 48 additions and 2 deletions
|
|
@ -688,8 +688,20 @@ func (r *CreateBackportReq) backportRef(
|
|||
return res
|
||||
}
|
||||
|
||||
prTitle := fmt.Sprintf("Backport %s into %s", pr.GetTitle(), ref)
|
||||
prBody, err := renderEmbeddedTemplate("backport-pr-message.tmpl", struct {
|
||||
// Generate title, removing existing "Backport" prefix to avoid stuttering
|
||||
cleanTitle := pr.GetTitle()
|
||||
if strings.HasPrefix(strings.ToLower(cleanTitle), "backport ") {
|
||||
cleanTitle = strings.TrimSpace(cleanTitle[9:]) // Remove "Backport " prefix
|
||||
}
|
||||
prTitle := fmt.Sprintf("Backport %s into %s", cleanTitle, ref)
|
||||
|
||||
// Choose template based on whether this is a CE backport
|
||||
templateName := "backport-pr-message.tmpl"
|
||||
if r.hasCEPrefix(ref) {
|
||||
templateName = "backport-ce-pr-message.tmpl"
|
||||
}
|
||||
|
||||
prBody, err := renderEmbeddedTemplate(templateName, struct {
|
||||
OriginPullRequest *libgithub.PullRequest
|
||||
Attempt *CreateBackportAttempt
|
||||
}{pr, res})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
## Backport Enterprise PR #{{ .OriginPullRequest.Number }}{{ if .Attempt.TargetRef }} into {{ .Attempt.TargetRef }} {{ end }}
|
||||
|
||||
{{ if .Attempt.Error }}
|
||||
:rotating_light:
|
||||
>**Warning** automatic backport of commits failed. If the first commit failed,
|
||||
you will see a blank no-op commit below. If at least one commit succeeded, you
|
||||
will see the backported commits up to, _but not including_, the commit where
|
||||
the merge conflict occurred.
|
||||
|
||||
The person who merged in the original PR is: @{{ .OriginPullRequest.GetMergedBy.GetLogin }}
|
||||
This person should resolve the merge-conflict(s) by either:
|
||||
* Manually completing the backports into this branch
|
||||
* Creating a new branch and manually backporting all commits
|
||||
|
||||
Error(s) encountered while attempting the backport:
|
||||
> {{ .Attempt.Error }}
|
||||
|
||||
To continue the backport process, please follow the instructions below:
|
||||
|
||||
1. Checkout the branch in this PR locally (or optionally create a new branch off {{ .OriginPullRequest.GetBase.GetRef }})
|
||||
1. Manually cherry-pick the missing commits from the original PR into this branch:
|
||||
1. Cherry-pick the commits from the original PR into this branch `git cherry-pick <commit-hash>` (see Overview of unprocessed commits below for the list of commits to cherry-pick)
|
||||
1. Resolve any conflicts that arise
|
||||
1. Remove any CE only files if the backport target branch is to ce
|
||||
1. Push the changes to this branch
|
||||
1. Update the PR description to reflect the new commit(s)
|
||||
|
||||
{{ end }}
|
||||
|
||||
The following text was copied from the body of the original pull request
|
||||
|
||||
---
|
||||
|
||||
{{ .OriginPullRequest.Body }}
|
||||
Loading…
Reference in a new issue