@@ -769,39 +769,45 @@ def check_guide(session: nox.Session):
769769
770770 exclude_args = [f"--exclude={ arg } " for arg in excludes ]
771771
772- # check all links in the guide
773- _run (
774- session ,
775- "lychee" ,
776- "--include-fragments" ,
777- str (PYO3_GUIDE_TARGET ),
778- * remap_args ,
779- * exclude_args ,
780- "--accept=200,429" ,
781- "--cache" ,
782- "--max-cache-age=7d" ,
783- f"--root-dir={ PYO3_GUIDE_TARGET } " ,
784- * session .posargs ,
785- external = True ,
786- )
787- # check external links in the docs
788- # (intra-doc links are checked by rustdoc)
789- _run (
790- session ,
791- "lychee" ,
792- str (PYO3_DOCS_TARGET ),
793- * remap_args ,
794- f"--exclude=file://{ PYO3_DOCS_TARGET } " ,
795- # exclude some old http links from copyright notices, known to fail
796- * exclude_args ,
797- "--accept=200,429" ,
798- # reduce the concurrency to avoid rate-limit from `pyo3.rs`
799- "--max-concurrency=32" ,
800- "--cache" ,
801- "--max-cache-age=7d" ,
802- * session .posargs ,
803- external = True ,
804- )
772+ try :
773+ # check all links in the guide
774+ _run (
775+ session ,
776+ "lychee" ,
777+ "--include-fragments" ,
778+ str (PYO3_GUIDE_TARGET ),
779+ * remap_args ,
780+ * exclude_args ,
781+ "--accept=200,429" ,
782+ "--cache" ,
783+ "--max-cache-age=7d" ,
784+ f"--root-dir={ PYO3_GUIDE_TARGET } " ,
785+ * session .posargs ,
786+ external = True ,
787+ )
788+ # check external links in the docs
789+ # (intra-doc links are checked by rustdoc)
790+ _run (
791+ session ,
792+ "lychee" ,
793+ str (PYO3_DOCS_TARGET ),
794+ * remap_args ,
795+ f"--exclude=file://{ PYO3_DOCS_TARGET } " ,
796+ # exclude some old http links from copyright notices, known to fail
797+ * exclude_args ,
798+ "--accept=200,429" ,
799+ # reduce the concurrency to avoid rate-limit from `pyo3.rs`
800+ "--max-concurrency=32" ,
801+ "--cache" ,
802+ "--max-cache-age=7d" ,
803+ * session .posargs ,
804+ external = True ,
805+ )
806+ except nox .command .CommandFailed :
807+ # on `main`, we ignore link check failures to allow the site to still be updated on push to main,
808+ # we want to run the link checker on main to populate the GitHub actions cache so PRs run more reliably.
809+ if os .environ .get ("GITHUB_REF" , "" ) != "refs/heads/main" :
810+ raise
805811
806812
807813@nox .session (name = "format-guide" , venv_backend = "none" )
0 commit comments