Commit 875645b56f for woocommerce
commit 875645b56fef9ea0c6db69b8c3ca816192dfbd48
Author: Alba Rincón <albarin@users.noreply.github.com>
Date: Mon Dec 1 23:11:22 2025 +0100
Add the reviewer to the update changelog PRs from the release process (#62174)
* Add the reviewer to the update changelog PRs from the release process
diff --git a/.github/workflows/release-compile-changelog.yml b/.github/workflows/release-compile-changelog.yml
index f181219911..bbfa077052 100644
--- a/.github/workflows/release-compile-changelog.yml
+++ b/.github/workflows/release-compile-changelog.yml
@@ -196,4 +196,4 @@ jobs:
OVERRIDE_DATE="--override ${{ github.event.inputs.release_date }}"
fi
- pnpm utils code-freeze changelog -o ${{ github.repository_owner }} -v $VERSION -b $SELECTED_BRANCH $APPEND_CHANGELOG $OVERRIDE_DATE
+ pnpm utils code-freeze changelog -o ${{ github.repository_owner }} -v $VERSION -b $SELECTED_BRANCH $APPEND_CHANGELOG $OVERRIDE_DATE -ga ${{ github.actor }}
diff --git a/tools/monorepo-utils/src/code-freeze/commands/changelog/index.ts b/tools/monorepo-utils/src/code-freeze/commands/changelog/index.ts
index 0c1d053848..c204ea68fc 100644
--- a/tools/monorepo-utils/src/code-freeze/commands/changelog/index.ts
+++ b/tools/monorepo-utils/src/code-freeze/commands/changelog/index.ts
@@ -51,6 +51,10 @@ export const changelogCommand = new Command( 'changelog' )
'Append changelog to the existing one instead of replacing it.',
false
)
+ .option(
+ '-ga --github-actor <githubActor>',
+ 'Github actor to use for the changelog.'
+ )
.requiredOption( '-v, --version <version>', 'Version to bump to' )
.action( async ( options: Options ) => {
const { owner, name, version, branch, devRepoPath } = options;
diff --git a/tools/monorepo-utils/src/code-freeze/commands/changelog/lib/index.ts b/tools/monorepo-utils/src/code-freeze/commands/changelog/lib/index.ts
index 0e144e0906..5c5e385f33 100644
--- a/tools/monorepo-utils/src/code-freeze/commands/changelog/lib/index.ts
+++ b/tools/monorepo-utils/src/code-freeze/commands/changelog/lib/index.ts
@@ -170,7 +170,7 @@ export const updateReleaseBranchChangelogs = async (
tmpRepoPath: string,
releaseBranch: string
): Promise< { deletionCommitHash: string; prNumber: number } > => {
- const { owner, name, version, commitDirectToBase } = options;
+ const { owner, name, version, commitDirectToBase, githubActor } = options;
const mainVersion = version.replace( /\.\d+(-.*)?$/, '' ); // For compatibility with Jetpack changelogger which expects X.Y as version.
try {
@@ -282,6 +282,7 @@ export const updateReleaseBranchChangelogs = async (
body: `${ warningMessage }This pull request was automatically generated to prepare the changelog for ${ version }`,
head: branch,
base: releaseBranch,
+ reviewers: [ githubActor ],
} );
Logger.notice( `Pull request created: ${ pullRequest.html_url }` );
@@ -321,7 +322,7 @@ export const updateBranchChangelog = async (
releaseBranch: string,
releaseBranchChanges: { deletionCommitHash: string; prNumber: number }
): Promise< number > => {
- const { owner, name, version } = options;
+ const { owner, name, version, githubActor } = options;
const { deletionCommitHash, prNumber } = releaseBranchChanges;
// Skip if there were no changelog files to delete
@@ -375,6 +376,7 @@ export const updateBranchChangelog = async (
}`,
head: branch,
base: releaseBranch,
+ reviewers: [ githubActor ],
} );
Logger.notice( `Pull request created: ${ pullRequest.html_url }` );
diff --git a/tools/monorepo-utils/src/code-freeze/commands/changelog/types.ts b/tools/monorepo-utils/src/code-freeze/commands/changelog/types.ts
index 00b6169a70..c8178be256 100644
--- a/tools/monorepo-utils/src/code-freeze/commands/changelog/types.ts
+++ b/tools/monorepo-utils/src/code-freeze/commands/changelog/types.ts
@@ -7,4 +7,5 @@ export type Options = {
commitDirectToBase?: boolean;
override?: string;
appendChangelog?: boolean;
+ githubActor?: string;
};
diff --git a/tools/monorepo-utils/src/core/github/repo.ts b/tools/monorepo-utils/src/core/github/repo.ts
index 15e1f2fb5c..25dca3ec1c 100644
--- a/tools/monorepo-utils/src/core/github/repo.ts
+++ b/tools/monorepo-utils/src/core/github/repo.ts
@@ -250,7 +250,7 @@ export const addLabelsToIssue = async (
};
/**
- * Create a pull request from branches on Github.
+ * Create a pull request from branches on GitHub.
*
* @param {Object} options pull request options.
* @param {string} options.head branch name containing the changes you want to merge.
@@ -260,6 +260,7 @@ export const addLabelsToIssue = async (
* @param {string} options.title pull request title.
* @param {string} options.body pull request body.
* @return {Promise<object>} pull request data.
+ * @param {string[]} options.reviewers list of GitHub usernames to request a review from.
*/
export const createPullRequest = async ( options: {
head: string;
@@ -268,8 +269,9 @@ export const createPullRequest = async ( options: {
name: string;
title: string;
body: string;
+ reviewers?: string[];
} ): Promise< CreatePullRequestEndpointResponse[ 'data' ] > => {
- const { head, base, owner, name, title, body } = options;
+ const { head, base, owner, name, title, body, reviewers } = options;
const pullRequest = await octokitWithAuth().request(
'POST /repos/{owner}/{repo}/pulls',
{
@@ -282,6 +284,18 @@ export const createPullRequest = async ( options: {
}
);
+ if ( reviewers && reviewers.length > 0 ) {
+ await octokitWithAuth().request(
+ 'POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers',
+ {
+ owner,
+ repo: name,
+ pull_number: pullRequest.data.number,
+ reviewers,
+ }
+ );
+ }
+
return pullRequest.data;
};