GitHub-only mirror notice (.github/README.md, synced from README.md), 'latest' is a full release
Build & Release / build (push) Canceled after 0s
Build & Release / build (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
# Writes .github/README.md = mirror notice + README.md. GitHub shows .github/README.md in preference to the root one,
|
||||
# while git.bug.tools (Gitea/Forgejo) shows the root README.md, so the notice only appears on the GitHub mirror.
|
||||
# Relative links are made repo-root-absolute ("/path") since the file lives in .github/. Run after editing README.md
|
||||
# (CI fails if it's out of date).
|
||||
import os, re, sys
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
NOTICE = ("> [!NOTE]\n> This is a read-only mirror of **https://git.bug.tools/bug/imgui-luau**. "
|
||||
"Releases are built here by GitHub Actions; development happens on git.bug.tools.\n\n")
|
||||
src = open(os.path.join(ROOT, "README.md")).read()
|
||||
def fix(m):
|
||||
url = m.group(2)
|
||||
if re.match(r"^([a-z]+:|#|/)", url): return m.group(0)
|
||||
return m.group(1) + "/" + url + ")"
|
||||
out = NOTICE + re.sub(r"(\]\()([^)\s]+)\)", fix, src)
|
||||
path = os.path.join(ROOT, ".github", "README.md")
|
||||
if "--check" in sys.argv:
|
||||
sys.exit(0 if os.path.exists(path) and open(path).read() == out else "out of date: run python3 tools/sync_github_readme.py")
|
||||
open(path, "w").write(out)
|
||||
print("wrote .github/README.md")
|
||||
Reference in New Issue
Block a user