From 233e1f10e3860435514b572a6c90c29726aff42c Mon Sep 17 00:00:00 2001 From: Paul-Henry Kajfasz Date: Wed, 5 Mar 2025 16:35:38 +0000 Subject: [PATCH] Removed outdated scripts for mkdocs + added check-docs ci --- .github/workflows/docs.yml | 23 +++++++++++++++++++++++ scripts/check-docs.sh | 21 +++++++++++++++++++++ scripts/docs_requirements.txt | 3 --- scripts/serve-doc-site.sh | 7 ------- 4 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 scripts/check-docs.sh delete mode 100755 scripts/docs_requirements.txt delete mode 100755 scripts/serve-doc-site.sh diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..a4d90cae5 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,23 @@ +# Runs docs related jobs. +# CI job heavily inspired by: https://github.com/tarides/changelog-check-action + +name: docs + +on: + pull_request: + types: [opened, reopened, synchronize, labeled, unlabeled] + +jobs: + documented: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@main + with: + fetch-depth: 0 + - name: Check for changes in the docs directory + env: + BASE_REF: ${{ github.event.pull_request.base.ref }} + NO_DOCS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'no docs') }} + run: ./scripts/check-docs.sh "${{ inputs.docs }}" + shell: bash diff --git a/scripts/check-docs.sh b/scripts/check-docs.sh new file mode 100644 index 000000000..94ce57308 --- /dev/null +++ b/scripts/check-docs.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -uo pipefail + +DOCS_DIR="docs/" + +if [ "${NO_DOCS_LABEL}" = "true" ]; then + # 'no docs' label set, so finish successfully + echo "\"no docs\" label has been set" + exit 0 +else + # a docs check is required + # fail if the diff is empty (no changes in docs directory) + if git diff --quiet "origin/${BASE_REF}" -- "${DOCS_DIR}"; then + >&2 echo "Changes should be accompanied by documentation updates in the \"docs/\" directory. +This behavior can be overridden by using the \"no docs\" label, which is used for changes +that don't require documentation updates or are purely maintenance-related." + exit 1 + fi + + echo "The \"docs/\" directory has been updated." +fi diff --git a/scripts/docs_requirements.txt b/scripts/docs_requirements.txt deleted file mode 100755 index 4c9b0d58b..000000000 --- a/scripts/docs_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -mkdocs-material==9.4.8 -markdown-include==0.8.1 -mkdocs-open-in-new-tab==1.0.3 diff --git a/scripts/serve-doc-site.sh b/scripts/serve-doc-site.sh deleted file mode 100755 index 1d1a7fd56..000000000 --- a/scripts/serve-doc-site.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -virtualenv venv -source venv/bin/activate -pip3 install -r scripts/docs_requirements.txt -mkdocs serve --strict