From bfc332a221af0dc279e206b419194194a030fa12 Mon Sep 17 00:00:00 2001 From: chenxc <997909544@qq.com> Date: Tue, 25 Aug 2026 11:35:53 +0800 Subject: [PATCH] Run the docs check on pull requests, not only on main. The deploy workflow already gates on `npm run check`, so a dead link or an out-of-sync translation cannot reach the site. But it only runs on main, so the failure lands after the merge: main goes red, and the site quietly keeps serving the previous build until someone notices and pushes a fix. Same command, same Node version, on the pull request instead -- where it can still be acted on. Co-Authored-By: Claude Opus 5 --- .github/workflows/pr-check.yml | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/pr-check.yml diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 0000000..9b5d876 --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,41 @@ +name: PR check + +# The deploy workflow already runs `npm run check` before publishing, so a broken +# link or an out-of-sync translation cannot reach the site. But it only runs on +# main, which means the failure arrives after the merge -- main goes red and the +# site keeps serving the previous build until someone pushes a fix. Running the +# same check on the pull request moves that signal to where it can still be acted +# on. +on: + pull_request: + branches: [main] + +permissions: + contents: read + +concurrency: + group: pr-check-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + name: build, links, i18n parity + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # lastUpdated in config.mts reads git history for each page, so a + # shallow clone changes the build output. + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - run: npm ci + + # Identical to the deploy workflow's gate: builds, then checks internal + # links, fragments, and that the English and Chinese trees still mirror + # each other. + - run: npm run check