@sentry/junior-github 0.161.0 → 0.162.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/annotations.d.ts +2 -2
- package/dist/index.js +31 -29
- package/package.json +2 -2
package/dist/annotations.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ConversationAnnotation, ConversationSidebarAnnotation } from "@sentry/junior-plugin-api";
|
|
2
|
-
/**
|
|
3
|
-
export declare function
|
|
2
|
+
/** Return GitHub annotations for a conversation row, newest first. */
|
|
3
|
+
export declare function githubSidebarAnnotations(annotations: ConversationAnnotation[]): ConversationSidebarAnnotation[];
|
package/dist/index.js
CHANGED
|
@@ -4506,13 +4506,6 @@ async function classifyGitHubPullRequestCommitComposition(args) {
|
|
|
4506
4506
|
}
|
|
4507
4507
|
|
|
4508
4508
|
// src/annotations.ts
|
|
4509
|
-
var STATUS_RANK = {
|
|
4510
|
-
warning: 5,
|
|
4511
|
-
open: 4,
|
|
4512
|
-
draft: 3,
|
|
4513
|
-
merged: 2,
|
|
4514
|
-
closed: 1
|
|
4515
|
-
};
|
|
4516
4509
|
var STATUS_ICON = {
|
|
4517
4510
|
warning: "triangle-alert",
|
|
4518
4511
|
open: "circle-dot",
|
|
@@ -4520,31 +4513,40 @@ var STATUS_ICON = {
|
|
|
4520
4513
|
merged: "git-merge",
|
|
4521
4514
|
closed: "circle-x"
|
|
4522
4515
|
};
|
|
4523
|
-
function
|
|
4516
|
+
function isPullRequestUrl(url) {
|
|
4517
|
+
try {
|
|
4518
|
+
return /^\/[^/]+\/[^/]+\/pull\/\d+(?:\/|$)/.test(new URL(url).pathname);
|
|
4519
|
+
} catch {
|
|
4520
|
+
return false;
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
function sidebarIconForStatus(status, url) {
|
|
4524
|
+
if (status === "open" && isPullRequestUrl(url)) return "git-pull-request";
|
|
4525
|
+
return STATUS_ICON[status];
|
|
4526
|
+
}
|
|
4527
|
+
function repositoryName(annotation) {
|
|
4524
4528
|
try {
|
|
4525
|
-
const [,
|
|
4526
|
-
return
|
|
4529
|
+
const [, , repo] = new URL(annotation.url).pathname.split("/");
|
|
4530
|
+
return repo || void 0;
|
|
4527
4531
|
} catch {
|
|
4528
4532
|
return void 0;
|
|
4529
4533
|
}
|
|
4530
4534
|
}
|
|
4531
|
-
function
|
|
4532
|
-
|
|
4533
|
-
const
|
|
4534
|
-
const
|
|
4535
|
-
return
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
label: repos.size === 1 ? [...repos.values()][0] : `${repos.size} repos`
|
|
4547
|
-
};
|
|
4535
|
+
function githubSidebarAnnotations(annotations) {
|
|
4536
|
+
return annotations.flatMap((annotation) => {
|
|
4537
|
+
const status = annotation.status;
|
|
4538
|
+
const label = repositoryName(annotation);
|
|
4539
|
+
return status && label ? [
|
|
4540
|
+
{
|
|
4541
|
+
annotation: {
|
|
4542
|
+
icon: sidebarIconForStatus(status, annotation.url),
|
|
4543
|
+
key: annotation.key,
|
|
4544
|
+
label
|
|
4545
|
+
},
|
|
4546
|
+
updatedAt: annotation.updatedAt
|
|
4547
|
+
}
|
|
4548
|
+
] : [];
|
|
4549
|
+
}).sort((left, right) => right.updatedAt.localeCompare(left.updatedAt)).map(({ annotation }) => annotation);
|
|
4548
4550
|
}
|
|
4549
4551
|
|
|
4550
4552
|
// src/webhooks/check-suite-enrichment.ts
|
|
@@ -5361,10 +5363,10 @@ function githubPlugin(options = {}) {
|
|
|
5361
5363
|
return {
|
|
5362
5364
|
annotationsByConversationId: Object.fromEntries(
|
|
5363
5365
|
ctx.conversationIds.flatMap((conversationId) => {
|
|
5364
|
-
const
|
|
5366
|
+
const annotations = githubSidebarAnnotations(
|
|
5365
5367
|
ctx.annotationsByConversationId[conversationId] ?? []
|
|
5366
5368
|
);
|
|
5367
|
-
return
|
|
5369
|
+
return annotations.length > 0 ? [[conversationId, annotations]] : [];
|
|
5368
5370
|
})
|
|
5369
5371
|
)
|
|
5370
5372
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.162.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.4.3",
|
|
34
|
-
"@sentry/junior-plugin-api": "0.
|
|
34
|
+
"@sentry/junior-plugin-api": "0.162.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.9.1",
|