Skip to content

Commit 9a819dd

Browse files
richardlauTrott
authored andcommitted
doc,tools: annotate broken links in actions workflow
Change format of logged messages when run on GitHub Actions (i.e. when the `GITHUB_ACTIONS` environment variable is true) so that broken links are highlighted inline in pull requests. Signed-off-by: Richard Lau <[email protected]> PR-URL: #34810 Refs: #34787 Reviewed-By: Mary Marchini <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 1b87035 commit 9a819dd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/doc/checkLinks.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ function checkFile(path) {
5050
const targetURL = new URL(node.url, base);
5151
if (targetURL.protocol === 'file:' && !fs.existsSync(targetURL)) {
5252
const { line, column } = node.position.start;
53-
console.error(`Broken link at ${path}:${line}:${column} (${node.url})`);
53+
console.error((process.env.GITHUB_ACTIONS ?
54+
`::error file=${path},line=${line},col=${column}::` : '') +
55+
`Broken link at ${path}:${line}:${column} (${node.url})`);
5456
process.exitCode = 1;
5557
}
5658
}

0 commit comments

Comments
 (0)