fix: shorten PR walkthrough links and align shell branding (#2954)
This commit is contained in:
@@ -12,6 +12,7 @@ from typing import Any
|
||||
START_MARKER = "<!-- kandev-pr-walkthrough-start -->"
|
||||
END_MARKER = "<!-- kandev-pr-walkthrough-end -->"
|
||||
SHA_PATTERN = re.compile(r"^[0-9a-f]{40}$")
|
||||
PUBLIC_SHA_LENGTH = 12
|
||||
UNCHANGED = 3
|
||||
|
||||
|
||||
@@ -49,7 +50,10 @@ def validate_url(url: str, pr_number: int, head_sha: str) -> None:
|
||||
raise ValueError("pull request number must be positive")
|
||||
if not SHA_PATTERN.fullmatch(head_sha):
|
||||
raise ValueError("head SHA must be 40 lowercase hexadecimal characters")
|
||||
expected = f"https://walkthrough.kandev.ai/pr/{pr_number}/{head_sha}.html"
|
||||
expected = (
|
||||
"https://walkthrough.kandev.ai/"
|
||||
f"pr/{pr_number}/{head_sha[:PUBLIC_SHA_LENGTH]}.html"
|
||||
)
|
||||
if url != expected:
|
||||
raise ValueError(f"expected walkthrough URL {expected}")
|
||||
|
||||
|
||||
@@ -11,8 +11,9 @@ import unittest
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
SCRIPT = REPO_ROOT / "scripts" / "pr-walkthrough-pr-body"
|
||||
PR_NUMBER = 2906
|
||||
HEAD_SHA = "a" * 40
|
||||
URL = f"https://walkthrough.kandev.ai/pr/{PR_NUMBER}/{HEAD_SHA}.html"
|
||||
HEAD_SHA = "0123456789abcdef0123456789abcdef01234567"
|
||||
SHORT_HEAD_SHA = HEAD_SHA[:12]
|
||||
URL = f"https://walkthrough.kandev.ai/pr/{PR_NUMBER}/{SHORT_HEAD_SHA}.html"
|
||||
START = "<!-- kandev-pr-walkthrough-start -->"
|
||||
END = "<!-- kandev-pr-walkthrough-end -->"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user