File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939DATE_RE = re .compile (r"^\d{4}-\d{2}-\d{2}$" )
4040IMAGE_EXT_RE = re .compile (r"\.(png|jpe?g|webp)$" , re .IGNORECASE )
4141TEMP_BOT_BRANCH_RE = re .compile (r"/paper-images/pr-\d+(/|$)" )
42+ ALLOWED_DOCS_URL_RE = re .compile (
43+ r"^https?://raw\.githubusercontent\.com/MilesCranmer/PySR_Docs/(master|refs/heads/master)/images/[^\s]+$" ,
44+ re .IGNORECASE ,
45+ )
4246
4347
4448def fail (msg : str ) -> "NoReturn" :
@@ -111,11 +115,16 @@ def main() -> None:
111115 image_s = image .strip ()
112116
113117 if image_s .startswith ("http://" ) or image_s .startswith ("https://" ):
114- # Reject temporary bot-branch URLs (these are not stable and shouldn't
115- # be used in papers.yml).
118+ # We expect authors to upload an image with the PR. URLs are typically
119+ # only used after a maintainer moves images to PySR_Docs.
120+ # Allow only the stable raw.githubusercontent.com location in PySR_Docs.
116121 if TEMP_BOT_BRANCH_RE .search (image_s ):
117122 errors .append (
118- f"{ prefix } .image: points to temporary bot branch URL; use a stable URL (e.g. PySR_Docs master)"
123+ f"{ prefix } .image: points to temporary bot branch URL; use a local uploaded image path (preferred)"
124+ )
125+ elif not ALLOWED_DOCS_URL_RE .match (image_s ):
126+ errors .append (
127+ f"{ prefix } .image: URL must be the stable PySR_Docs raw URL (or upload an image in this PR)"
119128 )
120129 else :
121130 # Must be a basename only (no paths)
You can’t perform that action at this time.
0 commit comments