Skip to content

Commit bace3f8

Browse files
committed
fix: clean up annotation message format
1 parent 876dc1f commit bace3f8

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

bin/annotate-link-errors.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,9 @@ function findLinkLine(filePath: string, link: string): number | null {
9595
return null;
9696
}
9797

98-
function emitAnnotation(
99-
file: string,
100-
line: number | null,
101-
link: string,
102-
errorType: string,
103-
): void {
98+
function emitAnnotation(file: string, line: number | null, link: string): void {
10499
const location = line !== null ? `file=${file},line=${line}` : `file=${file}`;
105-
// GHA annotation format: ::error file=<path>,line=<n>::<message>
106-
console.log(`::error ${location}::${link}${errorType}`);
100+
console.log(`::error ${location}::Invalid link: "${link}" was not resolved.`);
107101
}
108102

109103
function run(): void {
@@ -148,20 +142,19 @@ function run(): void {
148142
const linkMatch = content.match(/^\s*[]\s+(\S+)\s+-\s+(.+)$/);
149143
if (linkMatch && currentSlug) {
150144
const link = linkMatch[1];
151-
const errorType = linkMatch[2].trim();
152145

153146
const sourceFile = findSourceFile(currentSlug);
154147
if (!sourceFile) {
155148
// Can't map to a file — emit a generic annotation on the run.
156149
console.log(
157-
`::error::${link}${errorType} (in ${currentSlug}, source file not found)`,
150+
`::error::Invalid link: "${link}" was not resolved. (in ${currentSlug}, source file not found)`,
158151
);
159152
annotationCount++;
160153
continue;
161154
}
162155

163156
const lineNumber = findLinkLine(sourceFile, link);
164-
emitAnnotation(sourceFile, lineNumber, link, errorType);
157+
emitAnnotation(sourceFile, lineNumber, link);
165158
annotationCount++;
166159
}
167160
}

0 commit comments

Comments
 (0)