Commit 2d45249244d for woocommerce
commit 2d45249244d6f67e372a347726616b0517f5c28d
Author: Brian Coords <bacoords@gmail.com>
Date: Thu Nov 5 08:18:41 2026 -0800
Align release contributor list and summary counts (#70677)
* Update release contributors template
* Align release summary contributor count with generated list
* Count only Core commits in release contributors summary
diff --git a/.github/workflows/release-commits-and-contributors.yml b/.github/workflows/release-commits-and-contributors.yml
index 28b910b6ded..157add7fc9e 100644
--- a/.github/workflows/release-commits-and-contributors.yml
+++ b/.github/workflows/release-commits-and-contributors.yml
@@ -93,42 +93,28 @@ jobs:
exit 1
fi
- count-commits-and-contributors:
- name: Count commits and contributors between releases
+ count-commits:
+ name: Count commits between releases
needs: extract-versions
runs-on: ${{ github.repository == 'woocommerce/woocommerce' && fromJSON('{"group":"WooCommerce Release Checks"}') || 'ubuntu-latest' }}
timeout-minutes: 5
outputs:
commit_count: ${{ steps.count-commits.outputs.commit_count }}
- contributor_count: ${{ steps.count-commits.outputs.contributor_count }}
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- - name: Count
+ - name: Count commits
id: count-commits
run: |
CURRENT_BRANCH="origin/release/${{ needs.extract-versions.outputs.current_version }}"
PREVIOUS_BRANCH="origin/release/${{ needs.extract-versions.outputs.previous_version }}"
- set +e # Don't exit on error for the git command
- COMMIT_COUNT=$(git rev-list --count ${CURRENT_BRANCH} ^${PREVIOUS_BRANCH} 2>&1)
- COMMIT_EXIT_CODE=$?
-
- CONTRIBUTOR_COUNT=$(git log --format='%ae' ${PREVIOUS_BRANCH}..${CURRENT_BRANCH} | sort -u | wc -l 2>&1)
- CONTRIBUTOR_EXIT_CODE=$?
- set -e # Resume exit on error
-
- if [ $COMMIT_EXIT_CODE -eq 0 ] && [ $CONTRIBUTOR_EXIT_CODE -eq 0 ]; then
- echo "Found ${COMMIT_COUNT} commits and ${CONTRIBUTOR_COUNT} contributors in the ${{ needs.extract-versions.outputs.current_version }} release"
- echo "commit_count=${COMMIT_COUNT}" >> $GITHUB_OUTPUT
- echo "contributor_count=${CONTRIBUTOR_COUNT}" >> $GITHUB_OUTPUT
- else
- echo "Error counting commits: ${COMMIT_COUNT}"
- exit 1
- fi
+ COMMIT_COUNT=$(git rev-list --count "${CURRENT_BRANCH}" "^${PREVIOUS_BRANCH}")
+ echo "Found ${COMMIT_COUNT} commits in the ${{ needs.extract-versions.outputs.current_version }} release"
+ echo "commit_count=${COMMIT_COUNT}" >> "$GITHUB_OUTPUT"
generate-contributors-list:
name: Generate contributors list
@@ -137,6 +123,7 @@ jobs:
timeout-minutes: 10
outputs:
contributor_list_path: ${{ steps.generate-contributors-list.outputs.filepath }}
+ contributor_count: ${{ steps.generate-contributors-list.outputs.contributor_count }}
artifact_url: ${{ steps.output-artifact-url.outputs.artifact_url }}
steps:
- name: Checkout repository
@@ -177,7 +164,14 @@ jobs:
exit 1
fi
+ CONTRIBUTOR_COUNT=$(echo "$OUTPUT" | sed -n 's/^Contributors counted: \([0-9][0-9]*\)$/\1/p')
+ if [ -z "$CONTRIBUTOR_COUNT" ]; then
+ echo "Error: Could not find contributor count in $OUTPUT"
+ exit 1
+ fi
+
echo "filepath=${HTML_FILE_PATH}" >> $GITHUB_OUTPUT
+ echo "contributor_count=${CONTRIBUTOR_COUNT}" >> "$GITHUB_OUTPUT"
- name: Upload contributors HTML
id: artifact-upload
@@ -326,7 +320,7 @@ jobs:
send-slack-notification:
name: Send Slack Notification
- needs: [extract-versions, count-commits-and-contributors, generate-contributors-list, db-updates]
+ needs: [extract-versions, count-commits, generate-contributors-list, db-updates]
runs-on: ${{ github.repository == 'woocommerce/woocommerce' && fromJSON('{"group":"WooCommerce Release Checks"}') || 'ubuntu-latest' }}
timeout-minutes: 5
steps:
@@ -340,8 +334,8 @@ jobs:
:woo: *WooCommerce ${{ needs.extract-versions.outputs.current_version }} Release Summary*
📊 *Statistics:*
- • Commits: ${{ needs.count-commits-and-contributors.outputs.commit_count }}
- • Contributors: ${{ needs.count-commits-and-contributors.outputs.contributor_count }}
+ • Commits: ${{ needs.count-commits.outputs.commit_count }}
+ • Contributors: ${{ needs.generate-contributors-list.outputs.contributor_count }}
• <${{ needs.generate-contributors-list.outputs.artifact_url }}|Download Contributors List>
:database: *Database Updates:*
diff --git a/tools/release-posts/changelog/align-contributor-counts b/tools/release-posts/changelog/align-contributor-counts
new file mode 100644
index 00000000000..4da78897e15
--- /dev/null
+++ b/tools/release-posts/changelog/align-contributor-counts
@@ -0,0 +1,3 @@
+Significance: patch
+Type: dev
+Comment: Align release contributor credit and Slack counts; internal release tooling only.
diff --git a/tools/release-posts/index.ts b/tools/release-posts/index.ts
index 616a038bee1..9bcacb5c8e2 100644
--- a/tools/release-posts/index.ts
+++ b/tools/release-posts/index.ts
@@ -34,11 +34,26 @@ program
currentRef,
previousRef
);
+ const contributorNames = Array.from(
+ new Set(
+ Object.values( contributors ).flatMap( ( packageData ) =>
+ packageData.contributors
+ .map( ( contributor ) => contributor.login )
+ .filter(
+ ( login ): login is string =>
+ typeof login === 'string' && login.length > 0
+ )
+ )
+ )
+ ).sort( ( firstContributor, secondContributor ) =>
+ firstContributor.localeCompare( secondContributor )
+ );
Logger.endTask();
const html = await renderTemplate( 'contributors.ejs', {
contributors,
+ contributorNames,
} );
const tmpFile = join(
@@ -48,6 +63,7 @@ program
await writeFile( tmpFile, html );
+ Logger.notice( `Contributors counted: ${ contributorNames.length }` );
Logger.notice( `Contributors HTML generated at ${ tmpFile }` );
} );
diff --git a/tools/release-posts/templates/contributors.ejs b/tools/release-posts/templates/contributors.ejs
index 6610e29f55d..0d4c09469c6 100644
--- a/tools/release-posts/templates/contributors.ejs
+++ b/tools/release-posts/templates/contributors.ejs
@@ -1,35 +1,18 @@
-<% const NUMBER_COLUMNS_TO_DISPLAY = 6 %>
-<% for ( const packageName in contributors ) { %>
- <% const packageContributors = contributors[packageName].contributors %>
+<%
+ const commitCount = contributors[ 'WooCommerce Core' ]?.totalCommits ?? 0;
+ const contributorDisplayVersion =
+ typeof displayVersion !== 'undefined'
+ ? displayVersion
+ : Object.values( contributors )
+ .find( ( packageData ) => packageData.headRef )
+ ?.headRef.replace( /^release\//, '' ) || '';
+-%>
+<% if ( contributorNames.length ) { -%>
+<!-- wp:paragraph -->
+<p>WooCommerce <%= contributorDisplayVersion %> includes <%= commitCount %> commits. Thanks to <%= contributorNames.length %> contributors:</p>
+<!-- /wp:paragraph -->
- <% if (packageContributors) { %>
- <% if (packageContributors.length) { %>
- <h2><%= packageName.replace('-', ' ') %></h2>
- <% } %>
- <% const lastContributor = packageContributors[packageContributors.length - 1] %>
- <% let column = 1 %>
- <% for ( const contributor of packageContributors ) { %>
- <% if (column % NUMBER_COLUMNS_TO_DISPLAY === 1) { %>
- <!-- wp:columns -->
- <div class="wp-block-columns">
- <%- include('contributor', { contributor: contributor }) %>
- <% } else { %>
- <%- include('contributor', { contributor: contributor }) %>
- <% } %>
-
- <% if ( contributor.login === lastContributor.login && packageContributors.length % NUMBER_COLUMNS_TO_DISPLAY !== 0 ) { %>
- <% const columnsToAdd = NUMBER_COLUMNS_TO_DISPLAY - ( packageContributors.length % NUMBER_COLUMNS_TO_DISPLAY ) %>
- <% for ( let i = 0; i < columnsToAdd; i++ ) { %>
- <!-- wp:column -->
- <div class="wp-block-column"></div>
- <!-- /wp:column -->
- <% } %>
- <% } %>
- <% column ++ %>
- <% if ( ( column % NUMBER_COLUMNS_TO_DISPLAY === 1 ) || contributor.login === lastContributor.login ) { %>
- </div>
- <!-- /wp:columns -->
- <% } %>
- <% } %>
- <% } %>
-<% } %>
+<!-- wp:paragraph {"style":{"elements":{"link":{"color":{"text":"var:preset|color|contrast-2"}}}},"textColor":"contrast-2"} -->
+<p class="has-contrast-2-color has-text-color has-link-color"><% contributorNames.forEach( ( contributorName, index ) => { %><a href="https://github.com/<%= encodeURIComponent( contributorName ) %>" target="_blank"><%= contributorName %></a><% if ( index < contributorNames.length - 1 ) { %>, <% } %><% } ); %></p>
+<!-- /wp:paragraph -->
+<% } -%>