Skip to content

Commit ee4a47b

Browse files
fix: escape @ symbols in PR comments to prevent user mentions
1 parent 5818c5a commit ee4a47b

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
# Changelog
44

5+
## [3.1.1] - 2025-12-30
6+
7+
### Fixed
8+
9+
- Fixed PR comments to escape words starting with @ to prevent GitHub user mention triggers for decorators
10+
511
## [3.1.0] - 2025-12-30
612

713
### Added

dist/index.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "report-annotate",
33
"description": "Annotate PR from report e.g. junit",
4-
"version": "3.1.0",
4+
"version": "3.1.1",
55
"author": "",
66
"type": "module",
77
"private": true,

src/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,12 @@ function generateAnnotationSection(
370370
const noteType = `[!${levelName}]`;
371371
let section = `> ${noteType}\n`;
372372
for (const annotation of annotations) {
373-
let line = `> ${annotation.message}`;
373+
let message = annotation.message.replace(/@\w+/g, '`$&`');
374+
let line = `> ${message}`;
374375
if (annotation.properties.file && annotation.properties.startLine) {
375376
const location = `${annotation.properties.file}#L${annotation.properties.startLine}`;
376377
const link = `${baseUrl}/${location}`;
377-
line = `> [${location}](${link}) ${annotation.message}`;
378+
line = `> [${location}](${link}) ${message}`;
378379
}
379380
section += `${line}\n`;
380381
}

0 commit comments

Comments
 (0)