From 4a575855832fb82a7c50bea86fe2e655fe8236de Mon Sep 17 00:00:00 2001 From: lacatoire Date: Mon, 14 Sep 2026 09:28:56 +0200 Subject: [PATCH 1/2] ci: use the shared check-en-revision.php from doc-base --- .github/workflows/check-en-revision.yml | 44 ++++++++++++++----------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/check-en-revision.yml b/.github/workflows/check-en-revision.yml index 9fd190162..7b0066954 100644 --- a/.github/workflows/check-en-revision.yml +++ b/.github/workflows/check-en-revision.yml @@ -1,7 +1,10 @@ # https://docs.github.com/en/actions -# Checks that the EN-Revision comment of the .xml files changed in a PR points to -# the latest doc-en commit for that file. Emits a ::error annotation and fails if -# the hash is missing, wrong, from another file, or outdated. +# Checks that the EN-Revision tag of the .xml files changed in a PR matches +# the latest commit hash of the corresponding doc-en file. The script emits +# its own ::error annotations. +# +# The script is the one from doc-base, shared by all translations, and no +# longer an inline bash snippet local to this workflow. name: "Structure" @@ -16,16 +19,19 @@ permissions: jobs: revision: name: "Check EN-Revision" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - # The explicit ref takes the real head of the pull request, not the merge - # commit actions/checkout builds by default: that one has master as its - # second parent, so the diff below would also list every file landed on - # master since the last push to the pull request. + # es/, en/ and doc-base/ side by side: this is the layout expected by + # the doc-base scripts, the same as the one the build workflow uses. The + # explicit ref takes the real head of the pull request, not the merge commit + # actions/checkout builds by default: that one has master as its second + # parent, so the diff below would also list every file landed on master + # since the last push of the PR. - name: "Checkout translation" uses: actions/checkout@v7 with: + path: es ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 @@ -36,18 +42,16 @@ jobs: repository: php/doc-en fetch-depth: 0 + - name: "Checkout php/doc-base" + uses: actions/checkout@v7 + with: + path: doc-base + repository: php/doc-base + - name: "Check EN-Revision" run: | BASE="${{ github.event.pull_request.base.sha }}" - git fetch --no-tags --depth=1 origin "$BASE" - fail=0 - while IFS= read -r f; do - [ -f "$f" ] && [ -f "en/$f" ] || continue - declared=$(grep -oiP 'EN-Revision:\s*\K[0-9a-f]+' "$f" | head -1 || true) - latest=$(git -C en log -1 --format=%H -- "$f") - if [ "$declared" != "$latest" ]; then - echo "::error file=$f::EN-Revision ${declared:-missing} != latest doc-en commit $latest" - fail=1 - fi - done < <(git diff --name-only "$BASE"...HEAD -- '*.xml') - exit $fail + git -C es fetch --no-tags --depth=1 origin "$BASE" + git -C es diff --name-only "$BASE"...HEAD -- '*.xml' \ + | php8.1 doc-base/scripts/translation/check-en-revision.php \ + --lang=es --github From 79cf6bb2a2c1f51f52012f3512a75e57e7378d60 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Mon, 14 Sep 2026 10:08:49 +0200 Subject: [PATCH 2/2] fix: use ubuntu-latest instead of a pinned Ubuntu version --- .github/workflows/check-en-revision.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-en-revision.yml b/.github/workflows/check-en-revision.yml index 7b0066954..85561a5fa 100644 --- a/.github/workflows/check-en-revision.yml +++ b/.github/workflows/check-en-revision.yml @@ -19,7 +19,7 @@ permissions: jobs: revision: name: "Check EN-Revision" - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: # es/, en/ and doc-base/ side by side: this is the layout expected by # the doc-base scripts, the same as the one the build workflow uses. The @@ -53,5 +53,5 @@ jobs: BASE="${{ github.event.pull_request.base.sha }}" git -C es fetch --no-tags --depth=1 origin "$BASE" git -C es diff --name-only "$BASE"...HEAD -- '*.xml' \ - | php8.1 doc-base/scripts/translation/check-en-revision.php \ + | php8.3 doc-base/scripts/translation/check-en-revision.php \ --lang=es --github