diff --git a/.github/workflows/check-removed-urls.yml b/.github/workflows/check-removed-urls.yml index a232637..f98523f 100644 --- a/.github/workflows/check-removed-urls.yml +++ b/.github/workflows/check-removed-urls.yml @@ -1,6 +1,7 @@ name: Check for removed URLs on: + workflow_call: pull_request: branches: [main] @@ -24,33 +25,33 @@ jobs: repository: ${{ github.event.pull_request.base.repo.full_name }} fetch-depth: 0 path: base + - name: Checkout sphinx-stack + uses: actions/checkout@v5 + with: + repository: canonical/sphinx-stack + path: sphinx-stack - uses: actions/setup-python@v6 - name: Build docs run: | for dir in compare base; do pushd ${dir}/docs - make install - . .sphinx/venv/bin/activate make html popd done - name: Generate current URLs list run: | for dir in compare base; do - pushd ${dir}/docs - find ./_build/ -name '*.html' \ - | sed 's|/_build||;s|/index.html$|/|;s|.html$||' \ - | sort > urls.txt - popd + build_dir="${dir}/docs/_build" + urls_file="${dir}/docs/urls.txt" + + if [ ! -d "${build_dir}" ]; then + echo "Expected docs build directory not found: ${build_dir}" + exit 1 + fi + + find "${build_dir}" -name '*.html' \ + | sed "s|^${build_dir}||;s|^/html||;s|/index.html$|/|;s|.html$||" \ + | sort > "${urls_file}" done - name: Compare URLs - run: | - BASE_URLS_PATH="base/docs/urls.txt" - COMPARE_URLS_PATH="compare/docs/urls.txt" - removed=$(comm -23 ${BASE_URLS_PATH} ${COMPARE_URLS_PATH} ) - if [ -n "$removed" ]; then - echo "The following URLs were removed:" - echo "$removed" - echo "Please ensure removed pages are redirected" - exit 1 - fi + run: python3 sphinx-stack/docs/_dev/check_removed_urls.py diff --git a/.github/workflows/cla-check.yml b/.github/workflows/cla-check.yml index 56b465c..7de3076 100644 --- a/.github/workflows/cla-check.yml +++ b/.github/workflows/cla-check.yml @@ -5,6 +5,10 @@ on: pull_request: branches: [main] +permissions: + contents: read + pull-requests: read + jobs: cla-check: runs-on: ubuntu-latest diff --git a/.github/workflows/markdown-style-checks.yml b/.github/workflows/markdown-style-checks.yml index 883a8c1..c218164 100644 --- a/.github/workflows/markdown-style-checks.yml +++ b/.github/workflows/markdown-style-checks.yml @@ -1,6 +1,7 @@ name: Markdown style checks on: + workflow_call: push: branches: - main @@ -14,7 +15,7 @@ on: jobs: markdown-lint: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 with: