diff --git a/scripts/check_rst_syntax.py b/.github/scripts/check_rst_syntax.py similarity index 91% rename from scripts/check_rst_syntax.py rename to .github/scripts/check_rst_syntax.py index f6f417fb5c1..92ad3f4902f 100755 --- a/scripts/check_rst_syntax.py +++ b/.github/scripts/check_rst_syntax.py @@ -13,9 +13,9 @@ from typing import List, Tuple # RST patterns to detect (pattern, description) RST_PATTERNS: List[Tuple[str, str]] = [ (r"\.\.\s+code-block::", "RST code-block directive (use ```language instead)"), - (r":func:`", "RST :func: role (use regular Markdown links)"), - (r":class:`", "RST :class: role (use regular Markdown links)"), - (r":meth:`", "RST :meth: role (use regular Markdown links)"), + (r":func:", "RST :func: role (use regular Markdown links)"), + (r":class:", "RST :class: role (use regular Markdown links)"), + (r":meth:", "RST :meth: role (use regular Markdown links)"), ( r"\.\.\s+deprecated::", "RST deprecated directive (use !!! deprecated admonition)", @@ -29,7 +29,7 @@ RST_PATTERNS: List[Tuple[str, str]] = [ (r"\.\.\s+warning::", "RST warning directive (use !!! warning admonition)"), (r"\.\.\s+important::", "RST important directive (use !!! important admonition)"), (r"\.\.\s+note::", "RST note directive (use !!! note admonition)"), - (r":private:`", "RST :private: role (prefix name with underscore instead)"), + (r":private:", "RST :private: role (prefix name with underscore instead)"), (r"`[^`]+<[^>]+>`__", "RST anonymous hyperlink (use [text](link) instead)"), (r"`[^`]+<[^>]+>`_", "RST named hyperlink (use [text](link) instead)"), ] diff --git a/.github/workflows/check_rst_syntax.yml b/.github/workflows/check_rst_syntax.yml index 5e7e0c49642..e070cc95d50 100644 --- a/.github/workflows/check_rst_syntax.yml +++ b/.github/workflows/check_rst_syntax.yml @@ -40,13 +40,14 @@ jobs: uses: tj-actions/changed-files@v47 with: files: "**/*.py" + files_ignore: ".github/scripts/check_rst_syntax.py" - name: "🔍 Check for RST Syntax in Changed Files" if: steps.changed-files.outputs.any_changed == 'true' run: | echo "Checking the following files for RST syntax:" echo "${{ steps.changed-files.outputs.all_changed_files }}" - python scripts/check_rst_syntax.py ${{ steps.changed-files.outputs.all_changed_files }} + python .github/scripts/check_rst_syntax.py ${{ steps.changed-files.outputs.all_changed_files }} - name: "✅ No RST Syntax Detected" if: steps.changed-files.outputs.any_changed != 'true'