Created
January 5, 2023 22:08
-
-
Save agoose77/6d002a1f3213dc505121980e25474d24 to your computer and use it in GitHub Desktop.
GitHub Actions script for annotating results of Sphinx linkcheck
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
import json | |
docs_path = pathlib.Path("docs") | |
output_path = docs_path / "_build" / "linkcheck" / "output.json" | |
with output_path.open() as f: | |
data = [json.loads(l) for l in f] | |
for record in data: | |
if record['status'] != "broken": | |
continue | |
record['path'] = (docs_path / record['filename']) | |
print( | |
"::error file={path},line={lineno}::{uri} URI was {status} (code: {code}): {info}".format_map(record) | |
) | |
print( | |
"??file={path},line={lineno}??{uri} URI was {status} (code: {code}): {info}".format_map(record) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment