diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fc1f2af7200..d39fe306c59 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -38,4 +38,4 @@ jobs: - name: Install dependencies run: pip install absl-py mistune gftools - name: Check Knowledge graph - run: python3 .github/workflows/knowledge_graph.py + run: python3 .github/workflows/knowledge_graph.py --check_outbound_links diff --git a/.github/workflows/knowledge_graph.py b/.github/workflows/knowledge_graph.py index 9ee755dbf70..c89cb4fa382 100644 --- a/.github/workflows/knowledge_graph.py +++ b/.github/workflows/knowledge_graph.py @@ -68,6 +68,7 @@ def _any_unique_name_to_path(names: Mapping[str, str], target: str) -> str: flags.DEFINE_bool("print_valid", False, "Whether to print valid links") +flags.DEFINE_bool("check_outbound_links", False, "Check outbound urls") MdValue = Union[Mapping[str, "MdValue"]] @@ -222,7 +223,8 @@ def _check_md_files(knowledge: KnowledgeContent) -> bool: if not target: continue # TODO: are empty links bad if re.search("^http(s)?://", target.lower()): - result = _check_outbound_link(target) and result + if FLAGS.check_outbound_links: + result = _check_outbound_link(target) and result else: target_path = knowledge.link_target_to_path(target) result = _check_file_present(knowledge.repo_root, md_file, target, target_path) and result