Skip to content

Commit

Permalink
doc,tools: annotate broken links in actions workflow
Browse files Browse the repository at this point in the history
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 <riclau@uk.ibm.com>

PR-URL: #34810
Refs: #34787
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
richardlau authored and addaleax committed Sep 22, 2020
1 parent ad4dca3 commit 52ad835
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/doc/checkLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ function checkFile(path) {
const targetURL = new URL(node.url, base);
if (targetURL.protocol === 'file:' && !fs.existsSync(targetURL)) {
const { line, column } = node.position.start;
console.error(`Broken link at ${path}:${line}:${column} (${node.url})`);
console.error((process.env.GITHUB_ACTIONS ?
`::error file=${path},line=${line},col=${column}::` : '') +
`Broken link at ${path}:${line}:${column} (${node.url})`);
process.exitCode = 1;
}
}
Expand Down

0 comments on commit 52ad835

Please sign in to comment.