From 7a311394553fbbf1d63793ffe3727af05ede7f00 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Tue, 7 Jul 2026 12:46:06 +0200 Subject: [PATCH] CI: add EN-Revision check and align workflow group names with doc-fr --- .github/workflows/check-en-revision.yml | 47 +++++++++++++++++++++ .github/workflows/check-whitespace-push.yml | 2 +- .github/workflows/check-whitespace.yml | 2 +- .github/workflows/integrate.yaml | 2 +- 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/check-en-revision.yml diff --git a/.github/workflows/check-en-revision.yml b/.github/workflows/check-en-revision.yml new file mode 100644 index 000000000..d776d1962 --- /dev/null +++ b/.github/workflows/check-en-revision.yml @@ -0,0 +1,47 @@ +# 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. + +name: "Structure" + +on: + pull_request: + branches: ["master"] + types: [opened, synchronize] + +permissions: + contents: read + +jobs: + revision: + name: "Check EN-Revision" + runs-on: ubuntu-latest + steps: + - name: "Checkout translation" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: "Checkout php/doc-en" + uses: actions/checkout@v4 + with: + path: en + repository: php/doc-en + fetch-depth: 0 + + - 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 diff --git a/.github/workflows/check-whitespace-push.yml b/.github/workflows/check-whitespace-push.yml index 63732722c..eec440f3a 100644 --- a/.github/workflows/check-whitespace-push.yml +++ b/.github/workflows/check-whitespace-push.yml @@ -1,4 +1,4 @@ -name: check-whitespace-push +name: "Style" # Get the repository with all commits to ensure that we can analyze # all Pushes except in master branch. diff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml index a31b0b03b..306b4fe3e 100644 --- a/.github/workflows/check-whitespace.yml +++ b/.github/workflows/check-whitespace.yml @@ -1,4 +1,4 @@ -name: check-whitespace +name: "Style" # Get the repository with all commits to ensure that we can analyze # all of the commits contributed via the Pull Request. diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 5cd710920..f0d625c4d 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -1,6 +1,6 @@ # https://docs.github.com/en/actions -name: "Integrate" +name: "Structure" on: pull_request: null