From 038058d10c67bb8bf8bc99f8a4ce7bb915e6e1ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeffry=20W=C3=BCrmli?= Date: Mon, 16 Nov 2026 02:00:07 +0100 Subject: [PATCH] ci: add warn-only docs drift check for pull requests Report README sections whose linked code changed while the section did not. The job only annotates the pull request and never fails it, so the output can settle before it becomes a gate. The config lists the built-in ignore globs again because a present ignore key replaces them, and adds the changelog, license and contributing files, which are documentation rather than code. --- .docdrift.yaml | 43 ++++++++++++++++++++++++++++++++ .github/workflows/docs-drift.yml | 28 +++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .docdrift.yaml create mode 100644 .github/workflows/docs-drift.yml diff --git a/.docdrift.yaml b/.docdrift.yaml new file mode 100644 index 0000000..0220d4f --- /dev/null +++ b/.docdrift.yaml @@ -0,0 +1,43 @@ +# doc-drift-checker configuration. Reports README sections whose linked code +# changed while the section itself did not. Sections are linked to code through +# the file paths and relative links the docs mention. +docs: + - "README.md" + - "docs/*.md" + +# A present `ignore` key replaces the built-in defaults, so they are repeated +# here. Release notes, the license and contribution guidelines are +# documentation, not code the README describes. +ignore: + # tests + - "**/*_test.go" + - "**/*.test.*" + - "**/*.spec.*" + - "**/test/**" + - "**/tests/**" + - "**/__tests__/**" + - "**/testdata/**" + # generated code + - "**/*.pb.go" + - "**/*_gen.go" + - "**/*.generated.*" + - "**/generated/**" + - "**/*.min.js" + # lockfiles + - "**/go.sum" + - "**/package-lock.json" + - "**/yarn.lock" + - "**/pnpm-lock.yaml" + - "**/composer.lock" + - "**/Cargo.lock" + - "**/Gemfile.lock" + - "**/poetry.lock" + - "**/uv.lock" + # vendored code + - "**/vendor/**" + - "**/node_modules/**" + - "**/third_party/**" + # release notes, license, contribution guidelines + - "CHANGELOG.md" + - "LICENSE" + - "CONTRIBUTING.md" diff --git a/.github/workflows/docs-drift.yml b/.github/workflows/docs-drift.yml new file mode 100644 index 0000000..31464c5 --- /dev/null +++ b/.github/workflows/docs-drift.yml @@ -0,0 +1,28 @@ +name: Docs drift + +on: + pull_request: + +permissions: + contents: read + +jobs: + docs-drift: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version: stable + cache: false + - name: Install doc-drift-checker + run: | + GOBIN="$RUNNER_TEMP/bin" go install github.com/JtheGunner/doc-drift-checker/cmd/doc-drift-checker@v0.2.3 + - name: Check documentation drift + env: + BASE_REF: ${{ github.base_ref }} + run: | + git fetch --no-tags origin "+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}" + "$RUNNER_TEMP/bin/doc-drift-checker" check --base "origin/${BASE_REF}" --format github --warn-only