diff --git a/.github/workflows/reusable-docs.yml b/.github/workflows/reusable-docs.yml index 831a49ad3e2719..4f8905f800536d 100644 --- a/.github/workflows/reusable-docs.yml +++ b/.github/workflows/reusable-docs.yml @@ -46,7 +46,7 @@ jobs: continue-on-error: true run: | # Mark files the pull request modified - touch ${{ steps.changed_files.outputs.added_modified }} + python Doc/tools/touch-clean-files.py --clean ${{ steps.changed_files.outputs.added_modified }} # Build docs with the '-n' (nit-picky) option; convert warnings to annotations make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n --keep-going" html 2>&1 | python Doc/tools/warnings-to-gh-actions.py diff --git a/Doc/tools/touch-clean-files.py b/Doc/tools/touch-clean-files.py index 19bc1be31deb26..78454c824eb79e 100644 --- a/Doc/tools/touch-clean-files.py +++ b/Doc/tools/touch-clean-files.py @@ -3,7 +3,8 @@ Touch files that must pass Sphinx nit-picky mode so they are rebuilt and we can catch regressions. """ - +import argparse +import csv from pathlib import Path wrong_directory_msg = "Must run this script from the repo root" @@ -28,14 +29,28 @@ rst for rst in Path("Doc/").rglob("*.rst") if rst.parts[1] not in EXCLUDE_SUBDIRS } -with Path("Doc/tools/.nitignore").open() as clean_files: - DIRTY = { + +parser = argparse.ArgumentParser( + description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter +) +parser.add_argument("-c", "--clean", help="Comma-separated list of clean files") +args = parser.parse_args() + +if args.clean: + clean_files = next(csv.reader([args.clean])) + CLEAN = { Path(filename.strip()) for filename in clean_files - if filename.strip() and not filename.startswith("#") + if Path(filename.strip()).is_file() } - -CLEAN = ALL_RST - DIRTY - EXCLUDE_FILES +else: + with Path("Doc/tools/.nitignore").open() as ignored_files: + IGNORED = { + Path(filename.strip()) + for filename in ignored_files + if filename.strip() and not filename.startswith("#") + } + CLEAN = ALL_RST - IGNORED - EXCLUDE_FILES print("Touching:") for filename in sorted(CLEAN):