Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import mdEscape = require("markdown-escape");
import randomSeed = require("random-seed");
import { getErrorMessageFromStack, getHash, getHashForStack } from "./utils/hashStackTrace";
import { createCopyingOverlayFS, createTempOverlayFS, OverlayBaseFS } from "./utils/overlayFS";
import { asMarkdownInlineCode } from "./utils/markdownUtils";

interface Params {
/**
Expand Down Expand Up @@ -434,7 +435,7 @@ ${summary.replayScript}
`;
// No url means is user test repo
if (!summary.repo.url) {
text += `# Manually download user test \`${summary.repo.name}\`\n`;
text += `# Manually download user test ${asMarkdownInlineCode(summary.repo.name)}\n`;
}
else {
text += `git clone ${summary.repo.url} --recurse-submodules\n`;
Expand Down Expand Up @@ -512,7 +513,7 @@ ${summary.replayScript}
`;
// No url means is user test repo
if (!summary.repo.url) {
text += `# Manually download user test \`${summary.repo.name}\`\n`;
text += `# Manually download user test ${asMarkdownInlineCode(summary.repo.name)}\n`;
}
else {
text += `git clone ${summary.repo.url} --recurse-submodules\n`;
Expand Down Expand Up @@ -721,15 +722,15 @@ export async function getTscRepoResult(
summary += `### ${makeMarkdownLink(projectUrl)}\n`;

for (const errorMessage of newlyReportedErrorMessages) {
summary += ` - ${buildWithNewWhenOldFails ? "[NEW] " : ""}\`${errorMessage}\`\n`;
summary += ` - ${buildWithNewWhenOldFails ? "[NEW] " : ""}${asMarkdownInlineCode(errorMessage)}\n`;

for (const error of newlyReportedErrorMessageMap.get(errorMessage)!) {
summary += ` - ${error.fileUrl ? makeMarkdownLink(error.fileUrl) : "Project Scope"}${isComposite ? ` in ${makeMarkdownLink(error.projectUrl)}` : ``}\n`;
}
}

for (const errorMessage of newlyUnreportedErrorMessages) {
summary += ` - ${buildWithNewWhenOldFails ? "[MISSING] " : ""}\`${errorMessage}\`\n`;
summary += ` - ${buildWithNewWhenOldFails ? "[MISSING] " : ""}${asMarkdownInlineCode(errorMessage)}\n`;

for (const error of newlyUnreportedErrorMessageMap.get(errorMessage)!) {
summary += ` - ${error.fileUrl ? makeMarkdownLink(error.fileUrl) : "Project Scope"}${isComposite ? ` in ${makeMarkdownLink(error.projectUrl)}` : ``}\n`;
Expand Down
3 changes: 2 additions & 1 deletion src/postGithubComments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path = require("path");
import { artifactFolderUrlPlaceholder, getArtifactsApiUrlPlaceholder, Metadata, metadataFileName, RepoStatus, resultFileNameSuffix } from "./main";
import git = require("./utils/gitUtils");
import pu = require("./utils/packageUtils");
import { asMarkdownInlineCode } from "./utils/markdownUtils";

const { argv } = process;

Expand Down Expand Up @@ -76,7 +77,7 @@ const outputs = resultPaths.map(p =>
.replaceAll(getArtifactsApiUrlPlaceholder, getArtifactsApi));

const suiteDescription = isTopReposRun ? `top ${repoCount} repos` : "user tests";
let header = `@${userToTag} Here are the results of running the ${suiteDescription} with ${entrypoint} comparing \`${oldTscResolvedVersion}\` and \`${newTscResolvedVersion}\`:
let header = `@${userToTag} Here are the results of running the ${suiteDescription} with ${entrypoint} comparing ${asMarkdownInlineCode(oldTscResolvedVersion ?? "old")} and ${asMarkdownInlineCode(newTscResolvedVersion ?? "new")}:

${summary.join("\n")}`;

Expand Down
9 changes: 9 additions & 0 deletions src/utils/markdownUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function asMarkdownInlineCode(s: string) {
let backticks = "`";
let space = "";
while (s.includes(backticks)) {
backticks += "`";
space = " "
}
return `${backticks}${space}${s}${space}${backticks}`;
}