From ca1c3924e4f0fec87e862d5ebc55455bde33355b Mon Sep 17 00:00:00 2001 From: Alan Buscaglia Date: Wed, 21 Jan 2026 14:39:26 +0100 Subject: [PATCH] feat(ci): add ignored paths for docs and non-code files Files matching ignored patterns (docs, markdown, configs, examples) will not trigger any tests, saving CI resources. --- .github/scripts/test-impact.py | 37 ++++++++++++++++++++++++++++++++++ .github/test-impact.yml | 34 +++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/.github/scripts/test-impact.py b/.github/scripts/test-impact.py index 08a3666a7f..f97848f6b5 100755 --- a/.github/scripts/test-impact.py +++ b/.github/scripts/test-impact.py @@ -51,6 +51,23 @@ def matches_pattern(file_path: str, pattern: str) -> bool: return fnmatch.fnmatch(file_path, pattern) +def filter_ignored_files( + changed_files: list[str], ignored_paths: list[str] +) -> list[str]: + """Filter out files that match ignored patterns.""" + filtered = [] + for file_path in changed_files: + is_ignored = False + for pattern in ignored_paths: + if matches_pattern(file_path, pattern): + print(f" [IGNORED] {file_path} matches {pattern}", file=sys.stderr) + is_ignored = True + break + if not is_ignored: + filtered.append(file_path) + return filtered + + def check_critical_paths(changed_files: list[str], critical_paths: list[str]) -> bool: """Check if any changed file matches critical paths.""" for file_path in changed_files: @@ -159,6 +176,26 @@ def main(): # Load configuration config = load_config() + # Filter out ignored files (docs, configs, etc.) + ignored_paths = config.get("ignored", {}).get("paths", []) + changed_files = filter_ignored_files(changed_files, ignored_paths) + + if not changed_files: + print("\nAll changed files are ignored (docs, configs, etc.)", file=sys.stderr) + print("No tests needed.", file=sys.stderr) + set_github_output("run-all", "false") + set_github_output("sdk-tests", "") + set_github_output("api-tests", "") + set_github_output("ui-e2e", "") + set_github_output("modules", "none-ignored") + set_github_output("has-tests", "false") + return + + print( + f"\n{len(changed_files)} files remain after filtering ignored paths", + file=sys.stderr, + ) + # Check critical paths critical_paths = config.get("critical", {}).get("paths", []) if check_critical_paths(changed_files, critical_paths): diff --git a/.github/test-impact.yml b/.github/test-impact.yml index 221bce6535..3f90ad3d3a 100644 --- a/.github/test-impact.yml +++ b/.github/test-impact.yml @@ -3,6 +3,40 @@ # # Usage: Changes to paths in 'critical' always run all tests. # Changes to paths in 'modules' run only the mapped tests. +# Changes to paths in 'ignored' don't trigger any tests. + +# Ignored paths - changes here don't trigger any tests +# Documentation, configs, and other non-code files +ignored: + paths: + # Documentation + - docs/** + - "*.md" + - "**/*.md" + - mkdocs.yml + + # Config files that don't affect runtime + - .gitignore + - .gitattributes + - .editorconfig + - .pre-commit-config.yaml + - .backportrc.json + - CODEOWNERS + - LICENSE + + # IDE/Editor configs + - .vscode/** + - .idea/** + + # Examples and contrib (not production code) + - examples/** + - contrib/** + + # Skills (AI agent configs, not runtime) + - skills/** + + # Permissions docs + - permissions/** # Critical paths - changes here run ALL tests # These are foundational/shared code that can affect anything