From 48869814ac6b03ff5d8414254287b950c9d6d108 Mon Sep 17 00:00:00 2001 From: AKSHAT2802 Date: Wed, 3 Jun 2026 15:15:24 +0530 Subject: [PATCH 1/2] Build/Test Tools: Add workflow to generate changed files list on new version tags. Adds a GitHub Action that automatically generates a list of files changed between the newly tagged release and the previous release tag. This removes the need for contributors to manually run SVN or Git commands to produce the list used to update HelpHub documentation for each release. Fixes #64003. --- .github/workflows/generate-changed-files.yml | 109 +++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 .github/workflows/generate-changed-files.yml diff --git a/.github/workflows/generate-changed-files.yml b/.github/workflows/generate-changed-files.yml new file mode 100644 index 0000000000000..e829d937ce3de --- /dev/null +++ b/.github/workflows/generate-changed-files.yml @@ -0,0 +1,109 @@ +## +# A GitHub Action that generates a list of files changed between the newly +# tagged WordPress release and the previous release tag. +# +# This list is useful for updating documentation such as the HelpHub +# "Files Changed" section for each release. It replaces the need to manually +# run SVN or Git commands to produce the same output. +# +# Contributors can also run this workflow manually via the "workflow_dispatch" +# event, providing custom tag inputs to compare any two releases. +## +name: Generate Changed Files List + +on: + push: + tags: + - '[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.[0-9]+' + workflow_dispatch: + inputs: + compare_tag: + description: 'The newer tag to compare (e.g. 6.6.2)' + required: true + type: string + base_tag: + description: 'The older base tag to compare against (e.g. 6.6.1)' + required: true + type: string + +# Disable permissions for all available scopes by default. +# Any needed permissions should be configured at the job level. +permissions: {} + +jobs: + # Generates a list of files changed between two version tags. + # + # Performs the following steps: + # - Checks out the repository with full history to access all tags. + # - Determines the current and previous version tags. + # - Generates a sorted list of changed files using git diff. + # - Displays the list in the workflow run summary. + # - Uploads the list as a downloadable workflow artifact. + generate: + name: Generate changed files list + runs-on: ubuntu-24.04 + permissions: + contents: read + timeout-minutes: 10 + if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'workflow_dispatch' }} + + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} + persist-credentials: false + + - name: Determine the tags to compare + id: tags + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + CURRENT_TAG="${{ inputs.compare_tag }}" + PREVIOUS_TAG="${{ inputs.base_tag }}" + else + CURRENT_TAG="${GITHUB_REF_NAME}" + # Find the most recent version tag preceding the current one. + PREVIOUS_TAG=$( git tag --sort=-version:refname | grep -E '^[0-9]+\.[0-9]+(\.[0-9]+)?$' | grep -v "^${CURRENT_TAG}$" | head -1 ) + fi + + if [[ -z "${PREVIOUS_TAG}" ]]; then + echo "::error::Could not determine the previous version tag to compare against." + exit 1 + fi + + echo "Comparing ${PREVIOUS_TAG} to ${CURRENT_TAG}." + echo "current_tag=${CURRENT_TAG}" >> "$GITHUB_OUTPUT" + echo "previous_tag=${PREVIOUS_TAG}" >> "$GITHUB_OUTPUT" + + - name: Generate list of changed files + id: diff + run: | + CURRENT_TAG="${{ steps.tags.outputs.current_tag }}" + PREVIOUS_TAG="${{ steps.tags.outputs.previous_tag }}" + + git diff --name-status "${PREVIOUS_TAG}" "${CURRENT_TAG}" | sort > changed-files.txt + + FILE_COUNT=$( wc -l < changed-files.txt | tr -d ' ' ) + + { + echo "## Files Changed: \`${PREVIOUS_TAG}\` → \`${CURRENT_TAG}\`" + echo "" + echo "**${FILE_COUNT} file(s) changed** between \`${PREVIOUS_TAG}\` and \`${CURRENT_TAG}\`." + echo "" + echo "Status codes: \`A\` = Added, \`D\` = Deleted, \`M\` = Modified, \`R\` = Renamed." + echo "" + echo '```' + cat changed-files.txt + echo '```' + } >> "$GITHUB_STEP_SUMMARY" + + echo "file_count=${FILE_COUNT}" >> "$GITHUB_OUTPUT" + + - name: Upload changed files list as artifact + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: changed-files-${{ steps.tags.outputs.current_tag }} + path: changed-files.txt + if-no-files-found: error \ No newline at end of file From 334c41d8908ebad0a4f2a3f569324fc65009ad48 Mon Sep 17 00:00:00 2001 From: AKSHAT2802 Date: Wed, 3 Jun 2026 15:48:18 +0530 Subject: [PATCH 2/2] Build/Test Tools: Refactor environment variable usage in changed files generation workflow --- .github/workflows/generate-changed-files.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/generate-changed-files.yml b/.github/workflows/generate-changed-files.yml index e829d937ce3de..6e8f899c26dfa 100644 --- a/.github/workflows/generate-changed-files.yml +++ b/.github/workflows/generate-changed-files.yml @@ -58,10 +58,14 @@ jobs: - name: Determine the tags to compare id: tags + env: + EVENT_NAME: ${{ github.event_name }} + INPUT_COMPARE_TAG: ${{ inputs.compare_tag }} + INPUT_BASE_TAG: ${{ inputs.base_tag }} run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - CURRENT_TAG="${{ inputs.compare_tag }}" - PREVIOUS_TAG="${{ inputs.base_tag }}" + if [[ "${EVENT_NAME}" == "workflow_dispatch" ]]; then + CURRENT_TAG="${INPUT_COMPARE_TAG}" + PREVIOUS_TAG="${INPUT_BASE_TAG}" else CURRENT_TAG="${GITHUB_REF_NAME}" # Find the most recent version tag preceding the current one. @@ -79,10 +83,10 @@ jobs: - name: Generate list of changed files id: diff + env: + CURRENT_TAG: ${{ steps.tags.outputs.current_tag }} + PREVIOUS_TAG: ${{ steps.tags.outputs.previous_tag }} run: | - CURRENT_TAG="${{ steps.tags.outputs.current_tag }}" - PREVIOUS_TAG="${{ steps.tags.outputs.previous_tag }}" - git diff --name-status "${PREVIOUS_TAG}" "${CURRENT_TAG}" | sort > changed-files.txt FILE_COUNT=$( wc -l < changed-files.txt | tr -d ' ' )