From 406a5448350384d958ac82fac0faa5cf4f947a50 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Thu, 17 Sep 2026 15:26:17 +0200 Subject: [PATCH] feat(ci): verify course content against reality Adds scripts/verify-content.mjs with two modes. Offline checks gate pull requests: unknown template variables, a literal version that should have been templated, manifest entries pointing at files nobody wrote. Online checks run weekly and report rather than gate, because a vendor moving a URL must not block somebody's typo fix. The online half is what catches the drift that reading never does: links, image tags, whether nextcloud-docker-dev still defines the services the setup module tells readers to start, and whether the pinned version is still current. It found three things on its first run: an info.xml missed by the manual templating pass, a version range quoted in prose, and a broken occ docs link whose path segment had been dropped. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Anna Larch --- .github/workflows/verify-content.yml | 71 +++++++ content/php/beginner/1.md | 2 +- content/php/beginner/2.md | 2 +- content/php/beginner/4.md | 2 +- content/php/beginner/8.md | 2 +- package.json | 3 +- scripts/verify-content.mjs | 287 +++++++++++++++++++++++++++ 7 files changed, 364 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/verify-content.yml create mode 100755 scripts/verify-content.mjs diff --git a/.github/workflows/verify-content.yml b/.github/workflows/verify-content.yml new file mode 100644 index 0000000..817b110 --- /dev/null +++ b/.github/workflows/verify-content.yml @@ -0,0 +1,71 @@ +# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +name: Verify course content + +on: + pull_request: + paths: + - 'content/**' + - 'lib/content.ts' + - 'scripts/verify-content.mjs' + - '.github/workflows/verify-content.yml' + schedule: + # Weekly, Monday morning. The things this catches - a vendor moving a URL, + # an image tag disappearing, nextcloud-docker-dev changing under the setup + # module - drift over months, not hours. Running it more often would add + # nothing except load on other people's servers. + - cron: '17 6 * * 1' + workflow_dispatch: + +permissions: + contents: read + +jobs: + offline: + name: Offline checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - run: node scripts/verify-content.mjs + + online: + name: Online checks + # Never on pull requests: a dead third-party link must not block somebody's + # typo fix. This reports, it does not gate. + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Run online checks + id: verify + run: | + set +e + node scripts/verify-content.mjs --online > report.txt 2>&1 + echo "exit_code=$?" >> "$GITHUB_OUTPUT" + cat report.txt + + - name: Report failures + if: steps.verify.outputs.exit_code != '0' + env: + GH_TOKEN: ${{ github.token }} + TITLE: 'Course content verification is failing' + run: | + BODY=$(printf 'The weekly content check found problems. Full output:\n\n```\n%s\n```\n\nRun locally with `npm run verify:content -- --online`.\n\n[Workflow run](%s/%s/actions/runs/%s)\n' \ + "$(cat report.txt)" "$GITHUB_SERVER_URL" "$GITHUB_REPOSITORY" "$GITHUB_RUN_ID") + # One issue, kept up to date, rather than a new one every Monday. + EXISTING=$(gh issue list --state open --search "in:title \"$TITLE\"" --json number --jq '.[0].number') + if [ -n "$EXISTING" ]; then + gh issue comment "$EXISTING" --body "$BODY" + else + gh issue create --title "$TITLE" --body "$BODY" --label documentation + fi diff --git a/content/php/beginner/1.md b/content/php/beginner/1.md index 96009c0..849053c 100644 --- a/content/php/beginner/1.md +++ b/content/php/beginner/1.md @@ -287,7 +287,7 @@ If you're coming from tutorials written for NC32 or NC33, the development enviro - [nextcloud-docker-dev repository](https://github.com/nextcloud/nextcloud-docker-dev) — source of truth for the Docker environment - [Development environment — Nextcloud developer docs](https://docs.nextcloud.com/server/latest/developer_manual/getting_started/devenv.html) -- [occ command reference — Nextcloud admin docs](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html) +- [occ command reference — Nextcloud admin docs](https://docs.nextcloud.com/server/{{nextcloudVersion}}/admin_manual/occ_command.html)