From f57104bb1a5127faa591d0c8523f7c8467f2fa46 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Mon, 17 Aug 2020 12:21:57 -0400 Subject: [PATCH] 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 PR-URL: https://github.com/nodejs/node/pull/34810 Refs: https://github.com/nodejs/node/issues/34787 Reviewed-By: Mary Marchini Reviewed-By: James M Snell Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott --- tools/doc/checkLinks.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/doc/checkLinks.js b/tools/doc/checkLinks.js index 00697cc01cf01a..eea9af4cc9cfc9 100644 --- a/tools/doc/checkLinks.js +++ b/tools/doc/checkLinks.js @@ -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; } }