Commit f1481e26f7 for woocommerce

commit f1481e26f73a9b23be9203b5668b7353853ac14b
Author: Alba Rincón <albarin@users.noreply.github.com>
Date:   Wed Nov 26 12:32:53 2025 +0100

    Send release published notification only if it matches with the release branch version (#62125)

    * Send release published notification only if it matches with the release branch version

    * Use sparse checkout

diff --git a/.github/workflows/release-new-release-published.yml b/.github/workflows/release-new-release-published.yml
index 46497d3640..068362b84e 100644
--- a/.github/workflows/release-new-release-published.yml
+++ b/.github/workflows/release-new-release-published.yml
@@ -23,7 +23,52 @@ jobs:
     runs-on: ${{ ( github.repository == 'woocommerce/woocommerce' && 'blacksmith-2vcpu-ubuntu-2404' ) || 'ubuntu-latest' }}
     if: ${{ github.event.action == 'published' && ! ( contains( inputs.release_tag_name, '-dev' ) || contains( inputs.release_tag_name, '-rc' ) ) }}
     steps:
+      - name: 'Checkout repository'
+        uses: actions/checkout@v4
+        with:
+          ref: trunk
+          sparse-checkout: |
+            /plugins/woocommerce/woocommerce.php
+          sparse-checkout-cone-mode: false
+
+      - name: 'Get release branch from tag'
+        id: get-branch
+        env:
+          RELEASE_TAG: ${{ inputs.release_tag_name }}
+        run: |
+          # Extract major.minor from version (e.g., 10.3.5 -> 10.3)
+          if [[ "$RELEASE_TAG" =~ ^([0-9]+\.[0-9]+) ]]; then
+            major_minor="${BASH_REMATCH[1]}"
+            branch_name="release/${major_minor}"
+            echo "Release branch: $branch_name"
+            echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
+          else
+            echo "::error::Could not extract version from tag: $RELEASE_TAG"
+            exit 1
+          fi
+
+      - name: 'Validate release tag version matches the release branch version'
+        id: validate-version
+        env:
+          RELEASE_TAG: ${{ inputs.release_tag_name }}
+          BRANCH_NAME: ${{ steps.get-branch.outputs.branch_name }}
+        run: |
+          git fetch origin ${BRANCH_NAME}
+          git checkout ${BRANCH_NAME}
+          current_version=$( cat plugins/woocommerce/woocommerce.php | grep -oP '(?<=Version: )(.+)' | head -n1 )
+
+          echo "Current version from woocommerce.php: '$current_version'"
+          echo "Release tag version: '$RELEASE_TAG'"
+
+          if [[ "$current_version" != "$RELEASE_TAG" ]]; then
+            echo "::warning::The version in woocommerce.php ($current_version) does not match the release tag version ($RELEASE_TAG). Skipping notification."
+            echo "versions_match=false" >> $GITHUB_OUTPUT
+          else
+            echo "versions_match=true" >> $GITHUB_OUTPUT
+          fi
+
       - name: 'Notify to release channel'
+        if: steps.validate-version.outputs.versions_match == 'true'
         uses: archive/github-actions-slack@a62d71a4ea93e68cbdc37581166b0298bea512e9 # v 2.10.0
         with:
           slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}