Commit 1539a328a2 for woocommerce
commit 1539a328a2731e471f5a015a033acbd2c6897637
Author: Jorge A. Torres <jorge.torres@automattic.com>
Date: Wed Jan 28 18:04:33 2026 +0000
Add job summaries to release workflows (#62716)
diff --git a/.github/workflows/release-build-zip-file.yml b/.github/workflows/release-build-zip-file.yml
index aa9babe8f1..ba5b38e846 100644
--- a/.github/workflows/release-build-zip-file.yml
+++ b/.github/workflows/release-build-zip-file.yml
@@ -45,22 +45,34 @@ jobs:
contents: write # Required to fetch draft releases for some reason. See https://github.com/cli/cli/issues/9076#issuecomment-2146148572.
steps:
- name: Workflow checks
+ env:
+ BRANCH: ${{ inputs.branch || github.ref }}
run: |
# No special checks when running as a reusable workflow.
if [ "${{ ! contains( github.workflow_ref, 'release-build-zip-file.yml' ) }}" = "true" ]; then
exit 0
fi
+ # Log inputs to console.
+ echo "Building WooCommerce ZIP: branch=${BRANCH}, skip_verify=${{ inputs.skip_verify }}, create_github_release=${{ inputs.create_github_release }}"
+
+ # Write summary header.
+ options=""
+ [ "${{ inputs.skip_verify }}" = "true" ] && options="skipping verification"
+ [ "${{ inputs.create_github_release }}" = "true" ] && options="${options:+$options, }creating release"
+ [ -n "$options" ] && options=" ($options)"
+ echo "šØ Building WooCommerce ZIP from \`${BRANCH}\`${options}." >> $GITHUB_STEP_SUMMARY
+
# Must run from trunk.
if [ "${{ github.ref }}" != "refs/heads/trunk" ]; then
- echo "::error::This workflow must be run from the 'trunk' branch. Enter the release branch as input."
- exit 1
+ echo "::error::This workflow must be run from the 'trunk' branch. Enter the release branch as input."
+ exit 1
fi
# Can not skip verification for actual releases.
if [ "${{ inputs.create_github_release }}" = "true" ] && [ "${{ inputs.skip_verify }}" = "true" ]; then
- echo "::error::Verification can not be skipped when building for a release."
- exit 1
+ echo "::error::Verification cannot be skipped when building for a release."
+ exit 1
fi
# Checkout trunk.
@@ -92,32 +104,36 @@ jobs:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
+ # Helper to fail with console error and summary message.
+ fail() {
+ echo "::error::$1"
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "ā Build failed. See annotations or workflow logs for details." >> $GITHUB_STEP_SUMMARY
+ exit 1
+ }
+
# Branch name must be 'release/*'.
branch_name="${BRANCH#refs/heads/}"
- if [[ $branch_name != release/* ]] ; then
- echo "::error::Pre-build verification: branch name '$branch_name' is not matching 'release/*' pattern."
- exit 1
+ if [[ $branch_name != release/* ]]; then
+ fail "Branch name '$branch_name' does not match 'release/*' pattern."
fi
# Version number in branch name and plugin main version must match.
branch_plugin_version=$( cat checkout-branch/plugins/woocommerce/woocommerce.php | grep -oP '(?<=Version: )(.+)' | head -n1 )
version_prefix=${branch_name/"release/"/""}
- if [[ $branch_plugin_version != "$version_prefix."* ]] ; then
- echo "::error::Pre-build verification: release version in branch ($branch_plugin_version) is not matching '$version_prefix.*' pattern."
- exit 1
+ if [[ $branch_plugin_version != "$version_prefix."* ]]; then
+ fail "Release version in branch ($branch_plugin_version) does not match '$version_prefix.*' pattern."
fi
# GH release should not already exist.
if gh release view "$branch_plugin_version" &>/dev/null; then
- echo "::error::Pre-build verification: GitHub release '$branch_plugin_version' already exists."
- exit 1
+ fail "GitHub release '$branch_plugin_version' already exists."
fi
# Release should not already exist on wporg.
tag_exists=$(curl -s 'https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request\[slug\]=woocommerce' | jq "(.versions | has(\"$branch_plugin_version\"))")
if [ "$tag_exists" == "true" ]; then
- echo "::error::Tag '$branch_plugin_version' already exists on WordPress.org."
- exit 1
+ fail "Version '$branch_plugin_version' already exists on WordPress.org."
fi
# Stable version in release branch should match wporg.
@@ -133,24 +149,21 @@ jobs:
branch_stable_version=$( cat checkout-branch/plugins/woocommerce/readme.txt | grep -oP '(?<=Stable tag: )(.+)' | head -n1 )
if [[ $branch_stable_version != $svn_stable_version ]] ; then
- echo "::error::Pre-build verification: stable version in release branch ($branch_stable_version) is not matching the one in SVN trunk ($svn_stable_version)."
- exit 1
+ fail "Stable version in release branch ($branch_stable_version) does not match SVN trunk ($svn_stable_version)."
fi
fi
# No PRs against release branch should remain open.
count=$( gh pr list --search "is:open base:$BRANCH" --limit 1 --json number | jq length )
if (( count > 0 )); then
- echo "::error::Pre-build verification: there are PRs against the release branch ($BRANCH) still open."
- exit 1
+ fail "There are open PRs against the release branch ($BRANCH)."
fi
# No PRs with same milestone as main version should remain open.
milestone="$version_prefix.0"
count=$( gh pr list --search "is:open milestone:$milestone" --limit 1 --json number | jq length )
if (( count > 0 )); then
- echo "::error::Pre-build verification: there are PRs with milestone '$milestone' still open."
- exit 1
+ fail "There are open PRs with milestone '$milestone'."
fi
# Changelog section must have at least one entry.
@@ -184,7 +197,7 @@ jobs:
env:
BRANCH: ${{ inputs.branch || github.ref }}
run: |
- if ! git ls-remote --exit-code --heads https://github.com/${GITHUB_REPOSITORY} ${BRANCH} > /dev/null; then
+ if ! git ls-remote --exit-code --heads https://github.com/${GITHUB_REPOSITORY} ${BRANCH} > /dev/null; then
echo "::error::Source branch '$BRANCH' does not exist."
exit 1
fi
@@ -225,6 +238,10 @@ jobs:
commit_hash=$(git rev-parse "${{ inputs.branch || github.ref }}")
echo "commit-hash=$commit_hash" >> $GITHUB_OUTPUT
+ # Write artifact to summary.
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "š Build artifact: ${ARTIFACT_URL}" >> $GITHUB_STEP_SUMMARY
+
create-release:
name: Create GitHub release
runs-on: ${{ ( github.repository == 'woocommerce/woocommerce' && 'blacksmith-2vcpu-ubuntu-2404' ) || 'ubuntu-latest' }}
@@ -268,3 +285,11 @@ jobs:
--latest=false \
--draft \
$FLAGS
+
+ # Get the release URL directly using gh CLI, since drafts use a different URL.
+ release_url=$(gh release view "${{ steps.get_version.outputs.version }}" --json url --jq ".url")
+
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "š¦ Draft release created: ${release_url}" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "āļø For next steps, see the [release docs](https://developer.woocommerce.com/docs/contribution/releases/building-and-publishing/)." >> $GITHUB_STEP_SUMMARY
diff --git a/.github/workflows/release-bump-version.yml b/.github/workflows/release-bump-version.yml
index 00122db3a8..f2c862a38a 100644
--- a/.github/workflows/release-bump-version.yml
+++ b/.github/workflows/release-bump-version.yml
@@ -48,6 +48,9 @@ jobs:
- name: Get current version
id: get-current-version
run: |
+ # Log inputs to console.
+ echo "Bumping version: branch=${{ inputs.branch }}, bump-type=${{ inputs.bump-type }}"
+
version=$( cat plugins/woocommerce/woocommerce.php | grep -oP '(?<=Version: )(.+)' | head -n1 )
echo "Current version: $version"
echo "version=$version" >> $GITHUB_OUTPUT
@@ -61,8 +64,27 @@ jobs:
const bumpType = `${{ inputs.bump-type }}`;
const currentVersion = '${{ steps.get-current-version.outputs.version }}';
+ // Helper to write summary.
+ const writeSummary = async (nextVersion = null) => {
+ const versionTransition = nextVersion
+ ? `from \`${currentVersion}\` to \`${nextVersion}\``
+ : `from \`${currentVersion}\``;
+ await core.summary
+ .addRaw(`š Bumping version on \`${branch}\` ${versionTransition} (${bumpType} bump).\n`)
+ .write();
+ };
+
+ // Helper to write error to summary.
+ const writeSummaryError = async (errorMsg) => {
+ await core.summary
+ .addRaw(`\nā **Error:** ${errorMsg}\n`)
+ .write();
+ };
+
const m = currentVersion.match( /(?<base>\d+\.\d+)\.(?<patch>\d+)(-(?<prerelease>rc|beta|dev)(\.(?<prerelease_number>\d+))?)?/ );
if ( ! m ) {
+ await writeSummary();
+ await writeSummaryError(`Current version (${currentVersion}) does not have the expected format.`);
core.setFailed( `Current version (${ currentVersion }) does not have the expected format.` );
return;
}
@@ -81,11 +103,15 @@ jobs:
( 'rc' === prerelease && ! [ 'rc', 'stable' ].includes( bumpType ) );
if ( invalidBump ) {
+ await writeSummary();
+ await writeSummaryError(`Cannot perform a ${bumpType} bump on version ${currentVersion}.`);
core.setFailed( `Bump type (${ bumpType }) does not apply to current version (${ currentVersion }).` );
return;
}
if ( ( 'trunk' === branch && 'dev' !== bumpType ) || ( 'trunk' !== branch && 'dev' === bumpType ) ) {
+ await writeSummary();
+ await writeSummaryError(`Cannot perform a ${bumpType} bump on branch ${branch}.`);
core.setFailed( `Bump type (${ bumpType }) does not apply to source branch (${ branch }).` );
return;
}
@@ -108,10 +134,15 @@ jobs:
break;
default:
+ await writeSummary();
+ await writeSummaryError(`Invalid bump type: ${bumpType}.`);
core.setFailed(`Invalid bump type.`);
return;
}
+ // Write success summary header.
+ await writeSummary(newVersion);
+
core.setOutput( 'nextVersion', newVersion );
core.setOutput( 'nextStable', newVersion.replace( /-(dev|(beta|rc)\.\d+)/, '' ) );
core.setOutput( 'clearChangelog', '' === prerelease );
@@ -146,6 +177,8 @@ jobs:
sed -i -E "s/public \\\$version = '[0-9]+\.[0-9]+\.[0-9]+.*';/public \\\$version = '$NEXT_VERSION'\;/" includes/class-woocommerce.php
if git diff --quiet; then
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "ā **Error:** No file changes were detected. The version may already be set to ${NEXT_VERSION}." >> $GITHUB_STEP_SUMMARY
echo "::error::No changes to commit."
exit 1
fi
@@ -192,14 +225,18 @@ jobs:
fi
fi
- # Create PR.
- gh pr create \
+ # Create PR and capture URL.
+ pr_url=$(gh pr create \
--title 'Bump WooCommerce version to `${{ steps.compute-new-version.outputs.nextVersion }}` on `${{ inputs.branch }}`' \
--body 'This PR updates the versions in ${{ inputs.branch }} to ${{ steps.compute-new-version.outputs.nextVersion }}.'$'\n\n''<!-- [x] This Pull Request does not require a changelog -->' \
--base ${{ inputs.branch }} \
--head ${branch_name} \
--label Release \
${reviewer_arg} \
- ${milestone_arg}
+ ${milestone_arg})
+
+ # Write success to summary.
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "āļø **Next step:** Review and merge [the pull request](${pr_url})." >> $GITHUB_STEP_SUMMARY
diff --git a/.github/workflows/release-compile-changelog.yml b/.github/workflows/release-compile-changelog.yml
index bbfa077052..2c99ffe828 100644
--- a/.github/workflows/release-compile-changelog.yml
+++ b/.github/workflows/release-compile-changelog.yml
@@ -172,8 +172,13 @@ jobs:
SELECTED_BRANCH: ${{ steps.check-branch.outputs.selected_branch }}
GITHUB_TOKEN: ${{ secrets.WC_BOT_PR_CREATE_TOKEN || secrets.GITHUB_TOKEN }}
run: |
- echo "Using branch: $SELECTED_BRANCH"
- echo "Generating changelog for version: $VERSION"
+ set -o pipefail
+
+ # Log inputs to console.
+ echo "Compiling changelog: version=$VERSION, branch=$SELECTED_BRANCH, append_changelog=${{ github.event.inputs.append_changelog }}, release_date=${{ github.event.inputs.release_date }}"
+
+ # Write summary header.
+ echo "š Compiling changelog for \`$VERSION\` on \`$SELECTED_BRANCH\`." >> $GITHUB_STEP_SUMMARY
# Determine whether to replace or append.
APPEND_CHANGELOG=""
@@ -196,4 +201,18 @@ 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 -ga ${{ github.actor }}
+ # Run changelog tool and capture output.
+ output=$(pnpm utils code-freeze changelog -o ${{ github.repository_owner }} -v $VERSION -b $SELECTED_BRANCH $APPEND_CHANGELOG $OVERRIDE_DATE -ga ${{ github.actor }} 2>&1 | tee /dev/stderr)
+
+ # Parse PR output (tab-separated: URL, branch, type) and write to summary.
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "$output" | grep "^https://github.com/" | while IFS=$'\t' read -r url branch type; do
+ if [[ "$type" == "changelog" ]]; then
+ echo "ā
Changelog PR targeting \`$branch\` [created]($url)." >> $GITHUB_STEP_SUMMARY
+ else
+ echo "ā
Changefile deletion PR targeting \`$branch\` [created]($url)." >> $GITHUB_STEP_SUMMARY
+ fi
+ done
+
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "āļø **Next step:** Review and merge the PRs listed above." >> $GITHUB_STEP_SUMMARY
diff --git a/.github/workflows/release-update-stable-tag.yml b/.github/workflows/release-update-stable-tag.yml
index b07a5edc60..82053cbbbf 100644
--- a/.github/workflows/release-update-stable-tag.yml
+++ b/.github/workflows/release-update-stable-tag.yml
@@ -34,11 +34,15 @@ jobs:
steps:
- name: Check confirmation
run: |
+ # Log inputs to console.
+ echo "Updating stable tag: version=${{ github.event.inputs.version }}, confirm-update=${{ github.event.inputs.confirm-update }}, allow-revert=${{ github.event.inputs.allow-revert }}"
+
+ # Write summary header.
+ echo "š·ļø Updating stable tag to \`${{ github.event.inputs.version }}\`." >> $GITHUB_STEP_SUMMARY
+
if [ "${{ github.event.inputs.confirm-update }}" != "true" ]; then
- echo "::error::You must check the confirmation checkbox to proceed with the stable tag update"
+ echo "::error::You must check the confirmation checkbox to proceed with the stable tag update."
exit 1
- else
- echo "ā
Confirmation received - proceeding with stable tag update"
fi
- name: Validate release version
@@ -138,7 +142,7 @@ jobs:
if svn list "${{ secrets.WPORG_SVN_URL }}/tags/$TARGET_VERSION" --username "${{ secrets.WPORG_SVN_USERNAME }}" --password "${{ secrets.WPORG_SVN_PASSWORD }}" --non-interactive > /dev/null 2>&1; then
echo "ā
SVN tag '$TARGET_VERSION' exists"
else
- echo "::error::SVN tag '$TARGET_VERSION' does not exist in the repository"
+ echo "::error::SVN tag '$TARGET_VERSION' does not exist in the SVN repository"
exit 1
fi
@@ -218,6 +222,10 @@ jobs:
echo "š¤ Changes detected. Committing changes to SVN..."
svn commit -m "Setting stable tag to $TARGET_VERSION" --username "${{ secrets.WPORG_SVN_USERNAME }}" --password "${{ secrets.WPORG_SVN_PASSWORD }}" --non-interactive
echo "ā
Successfully committed stable tag update to $TARGET_VERSION"
+
+ # Write success to summary.
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "ā
WordPress.org SVN updated: [view readme.txt on WordPress.org](https://plugins.trac.wordpress.org/browser/woocommerce/trunk/readme.txt#L7)" >> $GITHUB_STEP_SUMMARY
fi
update-gh-stable-tag:
@@ -276,19 +284,22 @@ jobs:
git push origin "$UPDATE_BRANCH"
# Determine milestone from woocommerce.php version.
- milestone=$( cat ./plugins/woocommerce/woocommerce.php | grep -oP '(?<=Version: )(.+)' | head -n1 | sed 's/\.[0-9]\+\(-dev\)\?$/.0/' )
+ milestone=$( cat ./plugins/woocommerce/woocommerce.php | grep -oP '(?<=Version: )(.+)' | head -n1 | sed -E 's/^([0-9]+\.[0-9]+)\.[0-9]+.*$/\1.0/' )
echo "Using milestone: '$milestone'."
- gh pr create \
+ pr_url=$(gh pr create \
--title "Update stable tag to $TARGET_VERSION ($BRANCH_NAME)" \
--body "This PR updates the stable tag to $TARGET_VERSION." \
--base "$BRANCH_NAME" \
--head "$UPDATE_BRANCH" \
--reviewer ${{ github.actor }} \
--label Release \
- --milestone "$milestone"
+ --milestone "$milestone")
echo "ā
Successfully created PR to update stable tag to $TARGET_VERSION on $BRANCH_NAME with milestone $milestone"
+
+ # Write PR to summary.
+ echo "ā
PR targeting \`$BRANCH_NAME\` [created](${pr_url})." >> $GITHUB_STEP_SUMMARY
fi
notify-release:
@@ -304,3 +315,10 @@ jobs:
slack-optional-unfurl_links: false
slack-text: |
:woo-bounce: *<https://github.com/woocommerce/woocommerce/releases/tag/${{ github.event.inputs.version }}|WooCommerce ${{ github.event.inputs.version }}>* has been released! :rocket:
+
+ - name: Write next steps to summary
+ run: |
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "š¢ Release announcement sent." >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "āļø **Next step:** Review and merge the PRs listed above." >> $GITHUB_STEP_SUMMARY
diff --git a/.github/workflows/release-upload-to-wporg.yml b/.github/workflows/release-upload-to-wporg.yml
index 72eef1679b..335888dfae 100644
--- a/.github/workflows/release-upload-to-wporg.yml
+++ b/.github/workflows/release-upload-to-wporg.yml
@@ -30,6 +30,12 @@ jobs:
steps:
- name: Check confirmation
run: |
+ # Log inputs to console.
+ echo "Uploading to WordPress.org: release=${{ inputs.release }}, confirm-update=${{ github.event.inputs.confirm-update }}"
+
+ # Write summary header.
+ echo "š¤ Uploading release \`${{ inputs.release }}\` to WordPress.org." >> $GITHUB_STEP_SUMMARY
+
if [ "${{ github.event.inputs.confirm-update }}" != "true" ]; then
echo "::error::You must check the confirmation checkbox to proceed."
exit 1
@@ -227,6 +233,14 @@ jobs:
--non-interactive \
--config-option=servers:global:http-timeout=1800
+ # Write success to summary.
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "ā
Release committed to WordPress.org (trunk + tag):" >> $GITHUB_STEP_SUMMARY
+ echo "- [view trunk](https://plugins.trac.wordpress.org/browser/woocommerce/trunk)" >> $GITHUB_STEP_SUMMARY
+ echo "- [view tag](https://plugins.trac.wordpress.org/browser/woocommerce/tags/$RELEASE_TAG)" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "āļø **Next step:** Validate the release as described in the [release docs](https://developer.woocommerce.com/docs/contribution/releases/building-and-publishing/)." >> $GITHUB_STEP_SUMMARY
+
- name: Commit to tag only
if: ${{ needs.get-and-validate-release-asset.outputs.overwrite_trunk != 1 }}
working-directory: ./svn
@@ -253,3 +267,9 @@ jobs:
--no-auth-cache \
--non-interactive \
--config-option=servers:global:http-timeout=1800
+
+ # Write success to summary.
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "ā
Release committed to WordPress.org (tag only): [view tag](https://plugins.trac.wordpress.org/browser/woocommerce/tags/$RELEASE_TAG)" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "āļø **Next step:** Validate the release as described in the [release docs](https://developer.woocommerce.com/docs/contribution/releases/building-and-publishing/)." >> $GITHUB_STEP_SUMMARY
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 c204ea68fc..b777309db5 100644
--- a/tools/monorepo-utils/src/code-freeze/commands/changelog/index.ts
+++ b/tools/monorepo-utils/src/code-freeze/commands/changelog/index.ts
@@ -89,6 +89,13 @@ export const changelogCommand = new Command( 'changelog' )
const releaseBranch =
branch || `release/${ version.replace( /\.\d+(-.*)?$/, '' ) }`;
+ // Collect PR info for summary output.
+ const createdPRs: Array< {
+ branch: string;
+ type: string;
+ number: number;
+ } > = [];
+
// Update the release branch.
const releaseBranchChanges = await updateReleaseBranchChangelogs(
options,
@@ -96,16 +103,53 @@ export const changelogCommand = new Command( 'changelog' )
releaseBranch
);
+ if ( releaseBranchChanges.prNumber > 0 ) {
+ createdPRs.push( {
+ branch: releaseBranch,
+ type: 'changelog',
+ number: releaseBranchChanges.prNumber,
+ } );
+ }
+
// Update trunk.
- await updateTrunkChangelog(
+ const trunkPrNumber = await updateTrunkChangelog(
options,
tmpRepoPath,
releaseBranchChanges
);
- await updateIntermediateBranches(
+ if ( trunkPrNumber > 0 ) {
+ createdPRs.push( {
+ branch: 'trunk',
+ type: 'delete-changefiles',
+ number: trunkPrNumber,
+ } );
+ }
+
+ const intermediatePrNumbers = await updateIntermediateBranches(
options,
tmpRepoPath,
releaseBranchChanges
);
+
+ if ( intermediatePrNumbers ) {
+ for ( const pr of intermediatePrNumbers ) {
+ if ( pr.number > 0 ) {
+ createdPRs.push( {
+ branch: pr.branch,
+ type: 'delete-changefiles',
+ number: pr.number,
+ } );
+ }
+ }
+ }
+
+ // Output summary of created PRs (tab-separated for easy parsing).
+ Logger.notice( '--- Created PRs Summary ---' );
+ for ( const pr of createdPRs ) {
+ process.stdout.write(
+ `https://github.com/${ owner }/${ name }/pull/${ pr.number }\t${ pr.branch }\t${ pr.type }\n`
+ );
+ }
+ Logger.notice( '--- End PRs Summary ---' );
} );
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 261369d778..e6fdd5b42f 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
@@ -558,20 +558,23 @@ function getTargetBranches(
* @param {Object} releaseBranchChanges update data from updateReleaseBranchChangelogs
* @param {Object} releaseBranchChanges.deletionCommitHash commit from the changelog deletions in updateReleaseBranchChangelogs
* @param {Object} releaseBranchChanges.prNumber pr number created in updateReleaseBranchChangelogs
+ * @return {Promise<Array<{ branch: string; number: number }>>} Array of created PRs with branch and number
*/
export const updateIntermediateBranches = async (
options: Options,
tmpRepoPath: string,
releaseBranchChanges: { deletionCommitHash: string; prNumber: number }
-): Promise< void > => {
+): Promise< Array< { branch: string; number: number } > > => {
Logger.notice(
`Starting intermediate branches update for version ${ options.version }`
);
+ const createdPRs: Array< { branch: string; number: number } > = [];
+
const trunkVersion = await getTrunkWooCommerceVersion( tmpRepoPath );
if ( ! trunkVersion ) {
Logger.error( 'Could not determine WooCommerce trunk version.' );
- return;
+ return createdPRs;
}
const targetBranches = getTargetBranches( options.version, trunkVersion );
@@ -581,16 +584,21 @@ export const updateIntermediateBranches = async (
for ( const targetBranch of targetBranches ) {
try {
- await updateBranchChangelog(
+ const prNumber = await updateBranchChangelog(
options,
tmpRepoPath,
targetBranch,
releaseBranchChanges
);
+ if ( prNumber && prNumber > 0 ) {
+ createdPRs.push( { branch: targetBranch, number: prNumber } );
+ }
} catch ( error ) {
Logger.error(
`Failed to update ${ targetBranch }: ${ error.message }`
);
}
}
+
+ return createdPRs;
};