Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to /examples in PR description #2320

Merged
merged 2 commits into from
Jun 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions scripts/pr_link_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
LINK_START = "<!-- pr-link-docs:start -->"
LINK_END = "<!-- pr-link-docs:end -->"

LINK_TEMPLATE = "<!-- pr-link-docs:start -->\nDocs preview: {{ link }}\n<!-- pr-link-docs:end -->"
LINK_TEMPLATE = """<!-- pr-link-docs:start -->
Docs preview: {{ docs-link }}
Examples preview: {{ examples-link }}
<!-- pr-link-docs:end -->"""


def main() -> None:
Expand All @@ -34,8 +37,10 @@ def main() -> None:
latest_commit = pr.get_commits().reversed[0]

print(f"Latest commit: {latest_commit.sha}")
short_sha = latest_commit.sha[:7]

link = LINK_TEMPLATE.replace("{{ link }}", f"https://rerun.io/preview/{latest_commit.sha[:7]}/docs")
link = LINK_TEMPLATE.replace("{{ docs-link }}", f"https://rerun.io/preview/{short_sha}/docs")
link = link.replace("{{ examples-link }}", f"https://rerun.io/preview/{short_sha}/examples")
if EMPTY_LINK in pr.body:
print("Empty link found, updating it")
new_body = pr.body.replace(EMPTY_LINK, link)
Expand Down