Skip to content

Commit

Permalink
Link to /examples in PR description (#2320)
Browse files Browse the repository at this point in the history
<!--
Open the PR up as a draft until you feel it is ready for a proper
review.

Do not make PR:s from your own `main` branch, as that makes it difficult
for reviewers to add their own fixes.

Add any improvements to the branch as new commits to make it easier for
reviewers to follow the progress. All commits will be squashed to a
single commit once the PR is merged into `main`.

Make sure you mention any issues that this PR closes in the description,
as well as any other related issues.

To get an auto-generated PR description you can put "copilot:summary" or
"copilot:walkthrough" anywhere.
-->

### What

### Checklist

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2320

<!-- pr-link-docs:start -->
Docs preview: https://rerun.io/preview/3d1faa7/docs
Examples preview: https://rerun.io/preview/3d1faa7/examples
<!-- pr-link-docs:end -->
  • Loading branch information
jprochazk authored Jun 7, 2023
1 parent 11ece53 commit e33a48a
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit e33a48a

Please sign in to comment.