Skip to content

Commit 08f4a08

Browse files
committed
fix doc link automation
1 parent fd1b78c commit 08f4a08

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

build_readme.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,16 @@ def fetch_ruby_latest_version():
5353
readme_contents = replace_chunk(readme_contents, "news", posts_md)
5454

5555
# Update the doc links to point the latest ruby version docs
56-
current_stable_version = root / "current_stable_version.txt"
56+
current_stable_version = root / "current_ruby_doc_stable_version.txt"
5757
current_stable_version_contents = current_stable_version.open().read().strip()
5858
ruby_latest_version = fetch_ruby_latest_version()
5959

6060
if (current_stable_version_contents != ruby_latest_version):
6161
doc_links = re.search("<!-- doc_links starts -->(.*)<!-- doc_links ends -->", readme_contents, re.DOTALL).groups()[0].strip()
6262
updated_doc_links = re.sub("core-\d.\d.\d", f"core-{ruby_latest_version}", doc_links)
63-
readme_contents = replace_chunk(readme_contents, "doc_links", updated_doc_links)
64-
current_stable_version.open("w").write(ruby_latest_version)
63+
response = requests.get(updated_doc_links)
64+
if response.status_code == 200:
65+
readme_contents = replace_chunk(readme_contents, "doc_links", updated_doc_links)
66+
current_stable_version.open("w").write(ruby_latest_version)
6567

6668
readme.open("w").write(readme_contents)

current_ruby_doc_stable_version.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.1.2

current_stable_version.txt

-1
This file was deleted.

0 commit comments

Comments
 (0)