[doc-en] master: Fail the CI on changes to migrated extensions (#5840)

From: Date: Tue, 08 Sep 2026 07:51:43 +0000
Subject: [doc-en] master: Fail the CI on changes to migrated extensions (#5840)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23726@lists.php.net to get a copy of this message
Author: Louis-Arnaud (lacatoire) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-09-08T09:51:41+02:00 Commit: https://github.com/php/doc-en/commit/aa4943d2796d7713bc40351072025ceac366a391 Raw diff: https://github.com/php/doc-en/commit/aa4943d2796d7713bc40351072025ceac366a391.diff Fail the CI on changes to migrated extensions (#5840) * Fail the CI on changes to migrated extensions The extensions carrying a MOVING_TO_DOC_EXTENSIONS_DO_NOT_CHANGE_HERE.md notice are maintained in php/doc-extensions. A pull request adding to or modifying one of their reference folders now fails with a message pointing at the other repository; deletions are left alone. * Fetch the whole history with tree:0 instead of deepening The check only reads path names, never file contents, so a tree:0 partial clone brings the full commit history for about the cost of the shallow one it replaces. The base commit is then always present, which removes the fetch-and-deepen loop and one of its failure paths. Changed paths: A .github/workflows/migrated-extensions.yaml Diff: diff --git a/.github/workflows/migrated-extensions.yaml b/.github/workflows/migrated-extensions.yaml new file mode 100644 index 000000000000..54ddded8387f --- /dev/null +++ b/.github/workflows/migrated-extensions.yaml @@ -0,0 +1,106 @@ +# https://docs.github.com/en/actions + +name: "Migrated Extensions" + +on: + pull_request: + branches: + - "master" + types: + - "opened" + - "synchronize" + - "reopened" + - "labeled" + - "unlabeled" + +permissions: + contents: "read" + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + migrated-extensions: + name: "Migration Notice Check" + runs-on: "ubuntu-latest" + # Escape hatch for repository-wide sweeps; only a maintainer can label. + if: "! contains(github.event.pull_request.labels.*.name, 'skip-migrated-check')" + + env: + BASE_SHA: "${{ github.event.pull_request.base.sha }}" + NOTICE: "MOVING_TO_DOC_EXTENSIONS_DO_NOT_CHANGE_HERE.md" + + steps: + # The check only reads path names, never file contents, so a tree:0 + # partial clone brings the whole commit history for about the cost + # of a shallow one. The base commit is then always present, which + # is all the diff below needs. + - name: "Checkout php/doc-en" + uses: "actions/checkout@v7" + with: + ref: "${{ github.event.pull_request.head.sha }}" + fetch-depth: 0 + filter: "tree:0" + + - name: "Check the diff base is reachable" + run: | + set -euo pipefail + + if ! git merge-base "$BASE_SHA" HEAD >/dev/null 2>&1; then + echo "::error::No merge base with $BASE_SHA, cannot determine the changed files." + exit 1 + fi + + - name: "Check for changes to migrated extensions" + run: | + set -euo pipefail + + # Migrated extensions are those carrying a notice, read at the base. + # core.quotePath=false keeps non-ASCII paths from coming back quoted. + if ! tree="$(git -c core.quotePath=false ls-tree -r --name-only \ + "$BASE_SHA" -- reference)"; then + echo "::error::Cannot read reference/ at $BASE_SHA." + exit 1 + fi + + extensions="$(printf '%s\n' "$tree" \ + | grep -E "^reference/[^/]+/${NOTICE//./\\.}\$" \ + | cut -d/ -f2 | sort -u || true)" + + if [ -z "$extensions" ]; then + echo "No extension carries a migration notice, nothing to check." + exit 0 + fi + + # Deletions are left alone: emptying a migrated folder is the + # cleanup this check exists to lead to. + changed="$(git -c core.quotePath=false diff --name-only --no-renames \ + --diff-filter=d "$BASE_SHA...HEAD")" + + # Compare folder names, so reference/mysql/ never catches mysqli. + offending="" + while IFS= read -r file; do + case "$file" in + reference/*/*) ;; + *) continue ;; + esac + folder="${file#reference/}" + folder="${folder%%/*}" + if printf '%s\n' "$extensions" | grep -qxF "$folder"; then + offending="${offending}${file}"$'\n' + fi + done <<< "$changed" + + if [ -z "$offending" ]; then + echo "No file of a migrated extension is modified." + exit 0 + fi + + echo "::error::This pull request modifies extensions that are migrating to php/doc-extensions." + echo + echo "The following files belong to extensions carrying a $NOTICE notice:" + printf '%s' "$offending" | sed 's/^/ /' + echo + echo "Please open the pull request against https://github.com/php/doc-extensions instead." + exit 1

« previous php.doc.cvs (#23726) next »