From dbd12e40f31bab7f0b8bf79c344a1a43396c4706 Mon Sep 17 00:00:00 2001 From: Johnson Sun Date: Thu, 24 Oct 2024 03:10:49 +0800 Subject: [PATCH] ci(docs): Fix paths and add tests --- .github/workflows/{build-docs.yml => build-docs.yaml} | 8 +++++--- tests/lint_workflows.py | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) rename .github/workflows/{build-docs.yml => build-docs.yaml} (91%) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yaml similarity index 91% rename from .github/workflows/build-docs.yml rename to .github/workflows/build-docs.yaml index c375906d..0e4e18ac 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yaml @@ -3,8 +3,10 @@ name: Build Documentation on: push: branches: - - master - main + paths: + - .github/workflows/build-docs.yaml + - docs/** permissions: contents: write jobs: @@ -22,8 +24,8 @@ jobs: with: key: ${{ github.ref }} path: .cache - - run: pip install -r requirements.txt - - run: mkdocs gh-deploy --force + - run: pip install -r docs/requirements.txt + - run: cd docs && mkdocs gh-deploy --force # Ref: https://github.com/ojacques/mkdocs-git-committers-plugin-2 # Ref: https://github.com/ojacques/mkdocs-git-committers-plugin-2/issues/51#issuecomment-1951450239 env: diff --git a/tests/lint_workflows.py b/tests/lint_workflows.py index f73cc735..4b44119c 100644 --- a/tests/lint_workflows.py +++ b/tests/lint_workflows.py @@ -15,3 +15,6 @@ if content.count("@master") != content.count("master"): # Ref: https://github.com/j3soon/ros2-essentials/pull/44#pullrequestreview-2251404984 raise ValueError(f"`master` should not exist since it's obsolete: '{filename}'") +for filename in glob.glob(f"{repo_dir}/.github/workflows/*.yml"): + logging.debug(f"Checking: '{filename[len(repo_dir)+1:]}'...") + raise ValueError(f"workflows should use `.yaml` files instead of `.yml` files: '{filename}'")