@sentry/junior-github 0.203.0 → 0.204.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -400,15 +400,29 @@ function requesterLabel(args) {
|
|
|
400
400
|
const display = cleanDisplayValue(user?.displayName, userId) ?? cleanDisplayValue(identity?.displayName, userId) ?? cleanDisplayValue(identity?.handle, userId) ?? cleanDisplayValue(actor.fullName, userId) ?? cleanDisplayValue(actor.userName, userId);
|
|
401
401
|
return display ? `**${display.replaceAll("*", "\\*")}**` : void 0;
|
|
402
402
|
}
|
|
403
|
+
function parseExistingLabels(blockContents) {
|
|
404
|
+
const trimmed = blockContents.trim().replace(/\.$/, "");
|
|
405
|
+
if (!trimmed) {
|
|
406
|
+
return [];
|
|
407
|
+
}
|
|
408
|
+
const withoutLeadIn = trimmed.replace(/^(?:Requested by|via)\s+/i, "");
|
|
409
|
+
return withoutLeadIn.split(/,\s*(?=\*\*|Junior system actor `|via\s)/i).map((entry) => entry.trim().replace(/^via\s+/i, "")).filter(Boolean);
|
|
410
|
+
}
|
|
411
|
+
function formatAttributionBlock(labels) {
|
|
412
|
+
return `${GITHUB_REQUEST_ATTRIBUTION_START}
|
|
413
|
+
via ${labels.join(", ")}.
|
|
414
|
+
${GITHUB_REQUEST_ATTRIBUTION_END}`;
|
|
415
|
+
}
|
|
403
416
|
function applyAttribution(body, label) {
|
|
404
|
-
const attribution = label ? `${GITHUB_REQUEST_ATTRIBUTION_START}
|
|
405
|
-
Requested by ${label}.
|
|
406
|
-
${GITHUB_REQUEST_ATTRIBUTION_END}` : void 0;
|
|
407
417
|
const normalizedBody = body.trimEnd();
|
|
408
418
|
const existing = new RegExp(
|
|
409
|
-
`${GITHUB_REQUEST_ATTRIBUTION_START}[\\s\\S]
|
|
419
|
+
`${GITHUB_REQUEST_ATTRIBUTION_START}([\\s\\S]*?)${GITHUB_REQUEST_ATTRIBUTION_END}`
|
|
410
420
|
);
|
|
411
|
-
|
|
421
|
+
const existingMatch = normalizedBody.match(existing);
|
|
422
|
+
const existingLabels = existingMatch ? parseExistingLabels(existingMatch[1]) : [];
|
|
423
|
+
const labels = label && !existingLabels.includes(label) ? [...existingLabels, label] : existingLabels;
|
|
424
|
+
const attribution = labels.length ? formatAttributionBlock(labels) : void 0;
|
|
425
|
+
if (existingMatch) {
|
|
412
426
|
return attribution ? normalizedBody.replace(existing, attribution) : normalizedBody.replace(existing, "").trimEnd();
|
|
413
427
|
}
|
|
414
428
|
if (!attribution) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.204.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@sinclair/typebox": "^0.34.49",
|
|
32
32
|
"drizzle-orm": "^0.45.2",
|
|
33
33
|
"zod": "^4.5.4",
|
|
34
|
-
"@sentry/junior-plugin-api": "0.
|
|
34
|
+
"@sentry/junior-plugin-api": "0.204.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@oxlint/plugins": "1.79.0",
|