diff --git a/docs/docs/35-references/10-promotion-steps.md b/docs/docs/35-references/10-promotion-steps.md
index b715ada5c..1113aa275 100644
--- a/docs/docs/35-references/10-promotion-steps.md
+++ b/docs/docs/35-references/10-promotion-steps.md
@@ -1002,6 +1002,7 @@ requests.
| `sourceBranchFromStep` | `string` | N | Indicates the source branch should be determined by the `branch` key in the output of a previous promotion step with the specified alias. Mutually exclusive with `sourceBranch`.
__Deprecated: Use `sourceBranch` with an expression instead. Will be removed in v1.3.0.__ |
| `targetBranch` | `string` | N | The branch to which the changes should be merged. |
| `createTargetBranch` | `boolean` | N | Indicates whether a new, empty orphaned branch should be created and pushed to the remote if the target branch does not already exist there. Default is `false`. |
+| `title` | `string` | N | The title for the pull request. Kargo generates a title based on the commit messages if it is not explicitly specified. |
#### `git-open-pr` Example
diff --git a/internal/directives/git_pr_opener.go b/internal/directives/git_pr_opener.go
index 5810ac163..2192bee60 100644
--- a/internal/directives/git_pr_opener.go
+++ b/internal/directives/git_pr_opener.go
@@ -193,7 +193,12 @@ func (g *gitPROpener) runPromotionStep(
)
}
- title := strings.Split(commitMsg, "\n")[0]
+ var title string
+ if cfg.Title != "" {
+ title = cfg.Title
+ } else {
+ title = strings.Split(commitMsg, "\n")[0]
+ }
description := commitMsg
if stepCtx.UIBaseURL != "" {
description = fmt.Sprintf(
diff --git a/internal/directives/git_pr_opener_test.go b/internal/directives/git_pr_opener_test.go
index bb4f9074f..3da14a92d 100644
--- a/internal/directives/git_pr_opener_test.go
+++ b/internal/directives/git_pr_opener_test.go
@@ -107,6 +107,16 @@ func Test_gitPROpener_validate(t *testing.T) {
"targetBranch": "fake-branch",
},
},
+ {
+ name: "valid with custom title",
+ config: Config{
+ "provider": "github",
+ "repoURL": "https://github.com/example/repo.git",
+ "sourceBranch": "fake-branch",
+ "targetBranch": "another-fake-branch",
+ "title": "custom title",
+ },
+ },
}
r := newGitPROpener()
diff --git a/internal/directives/zz_config_types.go b/internal/directives/zz_config_types.go
index 6a9f964de..3a49b8da2 100644
--- a/internal/directives/zz_config_types.go
+++ b/internal/directives/zz_config_types.go
@@ -201,6 +201,9 @@ type GitOpenPRConfig struct {
// The branch to which the changes should be merged. This branch must already exist and be
// up to date on the remote.
TargetBranch string `json:"targetBranch"`
+ // The title of the PR. Kargo will build a title based on the commits if it is not explicitly
+ // specified.
+ Title string `json:"title"`
}
type GitPushConfig struct {