mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-07-15 00:52:15 +08:00
chore(ci): checking links and spell checking (#417)
* chore(ci): checking links and spell checking * chore(ci): move markdown-link-check to GitHub ci Because pre-commit.ci does not have access to the internet... * fix(lib): revert `reverse-...` utils because of warnings * chore(ci): checking links and spell checking * chore(ci): move markdown-link-check to GitHub ci Because pre-commit.ci does not have access to the internet... * fix(docs): myst-parser xref cannot end with .html * fix(docs): oops
This commit is contained in:
27
.github/scripts/check_github_issues.py
vendored
Normal file
27
.github/scripts/check_github_issues.py
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"""Check that GitHub issues (and PR) links match the number in Markdown link."""
|
||||
|
||||
import glob
|
||||
import re
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
p = re.compile(
|
||||
r"\[#(?P<number1>[0-9]+)\]"
|
||||
r"\(https://github\.com/"
|
||||
r"(?:[a-zA-Z0-9_-]+)/(?:[a-zA-Z0-9_-]+)/"
|
||||
r"(?:(?:issues)|(?:pull))/(?P<number2>[0-9]+)\)"
|
||||
)
|
||||
|
||||
ret_code = 0
|
||||
|
||||
for glob_pattern in sys.argv[1:]:
|
||||
for file in glob.glob(glob_pattern, recursive=True):
|
||||
with open(file) as f:
|
||||
for i, line in enumerate(f):
|
||||
for m in p.finditer(line):
|
||||
if m.group("number1") != m.group("number2"):
|
||||
start, end = m.span()
|
||||
print(f"{file}:{i}: ", line[start:end], file=sys.stderr) # noqa: T201
|
||||
ret_code = 1
|
||||
|
||||
sys.exit(ret_code)
|
Reference in New Issue
Block a user