Skip to content

Commit 43014a1

Browse files
feat: allow customizing PR body footer (#2115)
The function already exists, but it cannot be changed as a parameter for package users. This update makes the setting available to everyone. Co-authored-by: Jeff Ching <chingor@google.com>
1 parent 8502833 commit 43014a1

11 files changed

Lines changed: 72 additions & 3 deletions

File tree

__snapshots__/cli.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Options:
3131
branches [boolean] [default: false]
3232
--pull-request-title-pattern Title pattern to make release PR [string]
3333
--pull-request-header Header for release PR [string]
34+
--pull-request-footer Footer for release PR [string]
3435
--path release from path other than root directory
3536
[string]
3637
--component name of component release is being minted for
@@ -231,6 +232,7 @@ Options:
231232
branches [boolean] [default: false]
232233
--pull-request-title-pattern Title pattern to make release PR [string]
233234
--pull-request-header Header for release PR [string]
235+
--pull-request-footer Footer for release PR [string]
234236
--path release from path other than root directory
235237
[string]
236238
--component name of component release is being minted

docs/cli.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Extra options:
6363
| `--changelog-host` | `string` | Host for commit hyperlinks in the changelog. Defaults to `https://github.com` |
6464
| `--pull-request-title-pattern` | `string` | Override the pull request title pattern. Defaults to `chore${scope}: release${component} ${version}` |
6565
| `--pull-request-header` | `string` | Override the pull request header. Defaults to `:robot: I have created a release *beep* *boop*` |
66+
| `--pull-request-footer` | `string` | Override the pull request footer. Defaults to `This PR was generated with Release Please. See documentation.` |
6667
| `--extra-files` | `string[]` | Extra file paths for the release strategy to consider |
6768
| `--version-file` | `string` | Ruby only. Path to the `version.rb` file |
6869

@@ -112,6 +113,7 @@ need to specify your release options:
112113
| `--monorepo-tags` | boolean | Add prefix to tags and branches, allowing multiple libraries to be released from the same repository |
113114
| `--pull-request-title-pattern` | `string` | Override the pull request title pattern. Defaults to `chore${scope}: release${component} ${version}` |
114115
| `--pull-request-header` | `string` | Override the pull request header. Defaults to `:robot: I have created a release *beep* *boop*` |
116+
| `--pull-request-footer` | `string` | Override the pull request footer. Defaults to `This PR was generated with Release Please. See documentation.` |
115117
| `--signoff` | string | Add [`Signed-off-by`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) line at the end of the commit log message using the user and email provided. (format "Name \<email@example.com\>") |
116118
| `--extra-files` | `string[]` | Extra file paths for the release strategy to consider |
117119
| `--version-file` | `string` | Ruby only. Path to the `version.rb` file |
@@ -152,6 +154,7 @@ need to specify your release options:
152154
| `--monorepo-tags` | boolean | Add prefix to tags and branches, allowing multiple libraries to be released from the same repository |
153155
| `--pull-request-title-pattern` | `string` | Override the pull request title pattern. Defaults to `chore${scope}: release${component} ${version}` |
154156
| `--pull-request-header` | `string` | Override the pull request header. Defaults to `:robot: I have created a release *beep* *boop*` |
157+
| `--pull-request-footer` | `string` | Override the pull request footer. Defaults to `This PR was generated with Release Please. See documentation.` |
155158
| `--draft` | `boolean` | If set, create releases as drafts |
156159
| `--prerelease` | `boolean` | If set, create releases that are pre-major or pre-release version marked as pre-release on Github|
157160
| `--label` | `string` | Comma-separated list of labels to apply to the release pull requests. Defaults to `autorelease: pending` |

docs/customizing.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ option in the manifest configuration.
120120
By default, the pull request header is:
121121
`:robot: I have created a release *beep* *boop*`.
122122

123+
### Pull Request Footer
124+
125+
If you would like to customize the pull request footer, you can use the
126+
`--pull-request-footer` CLI option or the `pull-request-footer`
127+
option in the manifest configuration.
128+
129+
By default, the pull request footer is:
130+
`This PR was generated with Release Please. See documentation.`.
131+
123132
## Release Lifecycle Labels
124133

125134
By default, we open release pull requests with the `autorelease: pending`

schemas/config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@
103103
"description": "Customize the release pull request header.",
104104
"type": "string"
105105
},
106+
"pull-request-footer": {
107+
"description": "Customize the release pull request footer.",
108+
"type": "string"
109+
},
106110
"separate-pull-requests": {
107111
"description": "Open a separate release pull request for each component. Defaults to `false`.",
108112
"type": "boolean"
@@ -404,6 +408,7 @@
404408
"changelog-path": true,
405409
"pull-request-title-pattern": true,
406410
"pull-request-header": true,
411+
"pull-request-footer": true,
407412
"separate-pull-requests": true,
408413
"tag-separator": true,
409414
"extra-files": true,

src/bin/release-please.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ interface TaggingArgs {
115115
monorepoTags?: boolean;
116116
pullRequestTitlePattern?: string;
117117
pullRequestHeader?: string;
118+
pullRequestFooter?: string;
118119
}
119120

120121
interface CreatePullRequestArgs
@@ -419,6 +420,10 @@ function taggingOptions(yargs: yargs.Argv): yargs.Argv {
419420
.option('pull-request-header', {
420421
describe: 'Header for release PR',
421422
type: 'string',
423+
})
424+
.option('pull-request-footer', {
425+
describe: 'Footer for release PR',
426+
type: 'string',
422427
});
423428
}
424429

@@ -458,6 +463,7 @@ const createReleasePullRequestCommand: yargs.CommandModule<
458463
changelogHost: argv.changelogHost,
459464
pullRequestTitlePattern: argv.pullRequestTitlePattern,
460465
pullRequestHeader: argv.pullRequestHeader,
466+
pullRequestFooter: argv.pullRequestFooter,
461467
changelogSections: argv.changelogSections,
462468
releaseAs: argv.releaseAs,
463469
versioning: argv.versioningStrategy,

src/manifest.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export interface ReleaserConfig {
108108
includeVInTag?: boolean;
109109
pullRequestTitlePattern?: string;
110110
pullRequestHeader?: string;
111+
pullRequestFooter?: string;
111112
tagSeparator?: string;
112113
separatePullRequests?: boolean;
113114
labels?: string[];
@@ -165,6 +166,7 @@ interface ReleaserConfigJson {
165166
'changelog-host'?: string;
166167
'pull-request-title-pattern'?: string;
167168
'pull-request-header'?: string;
169+
'pull-request-footer'?: string;
168170
'separate-pull-requests'?: boolean;
169171
'tag-separator'?: string;
170172
'extra-files'?: ExtraFile[];
@@ -1311,6 +1313,7 @@ function extractReleaserConfig(
13111313
changelogType: config['changelog-type'],
13121314
pullRequestTitlePattern: config['pull-request-title-pattern'],
13131315
pullRequestHeader: config['pull-request-header'],
1316+
pullRequestFooter: config['pull-request-footer'],
13141317
tagSeparator: config['tag-separator'],
13151318
separatePullRequests: config['separate-pull-requests'],
13161319
labels: config['label']?.split(','),
@@ -1663,6 +1666,8 @@ function mergeReleaserConfig(
16631666
defaultConfig.pullRequestTitlePattern,
16641667
pullRequestHeader:
16651668
pathConfig.pullRequestHeader ?? defaultConfig.pullRequestHeader,
1669+
pullRequestFooter:
1670+
pathConfig.pullRequestFooter ?? defaultConfig.pullRequestFooter,
16661671
separatePullRequests:
16671672
pathConfig.separatePullRequests ?? defaultConfig.separatePullRequests,
16681673
skipSnapshot: pathConfig.skipSnapshot ?? defaultConfig.skipSnapshot,

src/plugins/merge.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {GitHub} from '../github';
2929
interface MergeOptions {
3030
pullRequestTitlePattern?: string;
3131
pullRequestHeader?: string;
32+
pullRequestFooter?: string;
3233
headBranchName?: string;
3334
forceMerge?: boolean;
3435
}
@@ -42,6 +43,7 @@ interface MergeOptions {
4243
export class Merge extends ManifestPlugin {
4344
private pullRequestTitlePattern?: string;
4445
private pullRequestHeader?: string;
46+
private pullRequestFooter?: string;
4547
private headBranchName?: string;
4648
private forceMerge: boolean;
4749

@@ -55,6 +57,7 @@ export class Merge extends ManifestPlugin {
5557
this.pullRequestTitlePattern =
5658
options.pullRequestTitlePattern ?? MANIFEST_PULL_REQUEST_TITLE_PATTERN;
5759
this.pullRequestHeader = options.pullRequestHeader;
60+
this.pullRequestFooter = options.pullRequestFooter;
5861
this.headBranchName = options.headBranchName;
5962
this.forceMerge = options.forceMerge ?? false;
6063
}
@@ -108,6 +111,7 @@ export class Merge extends ManifestPlugin {
108111
body: new PullRequestBody(releaseData, {
109112
useComponents: true,
110113
header: this.pullRequestHeader,
114+
footer: this.pullRequestFooter,
111115
}),
112116
updates,
113117
labels: Array.from(labels),

src/strategies/base.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export interface BaseStrategyOptions {
7575
includeVInTag?: boolean;
7676
pullRequestTitlePattern?: string;
7777
pullRequestHeader?: string;
78+
pullRequestFooter?: string;
7879
extraFiles?: ExtraFile[];
7980
versionFile?: string;
8081
snapshotLabels?: string[]; // Java-only
@@ -107,6 +108,7 @@ export abstract class BaseStrategy implements Strategy {
107108
protected initialVersion?: string;
108109
readonly pullRequestTitlePattern?: string;
109110
readonly pullRequestHeader?: string;
111+
readonly pullRequestFooter?: string;
110112
readonly extraFiles: ExtraFile[];
111113
readonly extraLabels: string[];
112114

@@ -139,6 +141,7 @@ export abstract class BaseStrategy implements Strategy {
139141
this.includeVInTag = options.includeVInTag ?? true;
140142
this.pullRequestTitlePattern = options.pullRequestTitlePattern;
141143
this.pullRequestHeader = options.pullRequestHeader;
144+
this.pullRequestFooter = options.pullRequestFooter;
142145
this.extraFiles = options.extraFiles || [];
143146
this.initialVersion = options.initialVersion;
144147
this.extraLabels = options.extraLabels || [];
@@ -225,7 +228,8 @@ export abstract class BaseStrategy implements Strategy {
225228
releaseNotesBody: string,
226229
_conventionalCommits: ConventionalCommit[],
227230
_latestRelease?: Release,
228-
pullRequestHeader?: string
231+
pullRequestHeader?: string,
232+
pullRequestFooter?: string
229233
): Promise<PullRequestBody> {
230234
return new PullRequestBody(
231235
[
@@ -235,7 +239,10 @@ export abstract class BaseStrategy implements Strategy {
235239
notes: releaseNotesBody,
236240
},
237241
],
238-
{header: pullRequestHeader}
242+
{
243+
header: pullRequestHeader,
244+
footer: pullRequestFooter,
245+
}
239246
);
240247
}
241248

@@ -326,7 +333,8 @@ export abstract class BaseStrategy implements Strategy {
326333
releaseNotesBody,
327334
conventionalCommits,
328335
latestRelease,
329-
this.pullRequestHeader
336+
this.pullRequestHeader,
337+
this.pullRequestFooter
330338
);
331339

332340
return {

src/strategies/dotnet-yoshi.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const DEFAULT_PULL_REQUEST_TITLE_PATTERN =
4040
'Release${component} version ${version}';
4141
const DEFAULT_PULL_REQUEST_HEADER =
4242
':robot: I have created a release *beep* *boop*';
43+
const DEFAULT_PULL_REQUEST_FOOTER =
44+
'This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).';
4345
const RELEASE_NOTES_HEADER_PATTERN =
4446
/#{2,3} \[?(\d+\.\d+\.\d+-?[^\]]*)\]?.* \((\d{4}-\d{2}-\d{2})\)/;
4547

@@ -61,6 +63,8 @@ export class DotnetYoshi extends BaseStrategy {
6163
options.pullRequestTitlePattern ?? DEFAULT_PULL_REQUEST_TITLE_PATTERN;
6264
options.pullRequestHeader =
6365
options.pullRequestHeader ?? DEFAULT_PULL_REQUEST_HEADER;
66+
options.pullRequestFooter =
67+
options.pullRequestFooter ?? DEFAULT_PULL_REQUEST_FOOTER;
6468
options.includeVInTag = options.includeVInTag ?? false;
6569
super(options);
6670
}

src/updaters/release-please-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function releaserConfigToJsonConfig(
7575
'changelog-host': config.changelogHost,
7676
'pull-request-title-pattern': config.pullRequestTitlePattern,
7777
'pull-request-header': config.pullRequestHeader,
78+
'pull-request-footer': config.pullRequestFooter,
7879
'separate-pull-requests': config.separatePullRequests,
7980
'tag-separator': config.tagSeparator,
8081
'extra-files': config.extraFiles,

0 commit comments

Comments
 (0)