From: Marc Foley Date: Fri, 16 Feb 2024 12:05:45 +0000 (+0000) Subject: add Flags.check_outbound_links X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c85262e23ce8d2424f6f0ee885f319f83028520a;p=thirdparty%2Fgoogle%2Ffonts.git add Flags.check_outbound_links --- diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fc1f2af720..d39fe306c5 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 9ee755dbf7..c89cb4fa38 100644 --- a/.github/workflows/knowledge_graph.py +++ b/.github/workflows/knowledge_graph.py @@ -68,6 +68,7 @@ FLAGS = flags.FLAGS 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