feat(dev-infra): automatically add labels to release PRs (#40016)
Automatically add provided labels to PRs created for release. PR Close #40016
This commit is contained in:
parent
17d2c8d7fa
commit
158269cb94
|
@ -32,7 +32,5 @@ export const release: ReleaseConfig = {
|
||||||
generateReleaseNotesForHead: async () => {
|
generateReleaseNotesForHead: async () => {
|
||||||
exec('yarn -s gulp changelog', {cwd: join(__dirname, '../')});
|
exec('yarn -s gulp changelog', {cwd: join(__dirname, '../')});
|
||||||
},
|
},
|
||||||
// The `comp: *` labels will be automatically added by PullApprove and the targeting label will
|
|
||||||
// be added by the release tooling, only `action: merge` must be manually included to the list.
|
|
||||||
releasePrLabels: ['comp: build & ci', 'action: merge', 'PullApprove: disable'],
|
releasePrLabels: ['comp: build & ci', 'action: merge', 'PullApprove: disable'],
|
||||||
};
|
};
|
||||||
|
|
|
@ -5676,6 +5676,10 @@ class ReleaseAction {
|
||||||
const { fork, branchName } = yield this._pushHeadToFork(proposedForkBranchName, true);
|
const { fork, branchName } = yield this._pushHeadToFork(proposedForkBranchName, true);
|
||||||
const { data } = yield this.git.github.pulls.create(Object.assign(Object.assign({}, this.git.remoteParams), { head: `${fork.owner}:${branchName}`, base: targetBranch, body,
|
const { data } = yield this.git.github.pulls.create(Object.assign(Object.assign({}, this.git.remoteParams), { head: `${fork.owner}:${branchName}`, base: targetBranch, body,
|
||||||
title }));
|
title }));
|
||||||
|
// Add labels to the newly created PR if provided in the configuration.
|
||||||
|
if (this.config.releasePrLabels !== undefined) {
|
||||||
|
yield this.git.github.issues.addLabels(Object.assign(Object.assign({}, this.git.remoteParams), { issue_number: data.number, labels: this.config.releasePrLabels }));
|
||||||
|
}
|
||||||
info(green(` ✓ Created pull request #${data.number} in ${repoSlug}.`));
|
info(green(` ✓ Created pull request #${data.number} in ${repoSlug}.`));
|
||||||
return {
|
return {
|
||||||
id: data.number,
|
id: data.number,
|
||||||
|
|
|
@ -34,6 +34,8 @@ export interface ReleaseConfig {
|
||||||
*/
|
*/
|
||||||
// TODO: Remove this in favor of a canonical changelog format across the Angular organization.
|
// TODO: Remove this in favor of a canonical changelog format across the Angular organization.
|
||||||
extractReleaseNotesPattern?: (version: semver.SemVer) => RegExp;
|
extractReleaseNotesPattern?: (version: semver.SemVer) => RegExp;
|
||||||
|
/** The list of github labels to add to the release PRs. */
|
||||||
|
releasePrLabels?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configuration for releases in the dev-infra configuration. */
|
/** Configuration for releases in the dev-infra configuration. */
|
||||||
|
|
|
@ -282,6 +282,15 @@ export abstract class ReleaseAction {
|
||||||
title,
|
title,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add labels to the newly created PR if provided in the configuration.
|
||||||
|
if (this.config.releasePrLabels !== undefined) {
|
||||||
|
await this.git.github.issues.addLabels({
|
||||||
|
...this.git.remoteParams,
|
||||||
|
issue_number: data.number,
|
||||||
|
labels: this.config.releasePrLabels,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
info(green(` ✓ Created pull request #${data.number} in ${repoSlug}.`));
|
info(green(` ✓ Created pull request #${data.number} in ${repoSlug}.`));
|
||||||
return {
|
return {
|
||||||
id: data.number,
|
id: data.number,
|
||||||
|
|
Loading…
Reference in New Issue