@sentry/junior-github 0.151.0 → 0.152.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
CHANGED
|
@@ -1963,11 +1963,13 @@ async function recordGitHubPullRequestOutcome(db, input) {
|
|
|
1963
1963
|
lte2(juniorGitHubPullRequests.updatedAt, outcome.updatedAt)
|
|
1964
1964
|
)
|
|
1965
1965
|
).returning({
|
|
1966
|
-
commitComposition: juniorGitHubPullRequests.commitComposition
|
|
1966
|
+
commitComposition: juniorGitHubPullRequests.commitComposition,
|
|
1967
|
+
conversationIds: juniorGitHubPullRequests.conversationIds
|
|
1967
1968
|
});
|
|
1968
1969
|
return {
|
|
1969
1970
|
applied: updated.length > 0,
|
|
1970
|
-
commitComposition: updated[0]?.commitComposition ?? void 0
|
|
1971
|
+
commitComposition: updated[0]?.commitComposition ?? void 0,
|
|
1972
|
+
conversationIds: updated[0]?.conversationIds ?? []
|
|
1971
1973
|
};
|
|
1972
1974
|
}
|
|
1973
1975
|
const inserted = await db.insert(juniorGitHubPullRequests).values({ pullRequestId: outcome.pullRequestId, ...values }).onConflictDoUpdate({
|
|
@@ -1975,11 +1977,13 @@ async function recordGitHubPullRequestOutcome(db, input) {
|
|
|
1975
1977
|
set: values,
|
|
1976
1978
|
where: lte2(juniorGitHubPullRequests.updatedAt, outcome.updatedAt)
|
|
1977
1979
|
}).returning({
|
|
1978
|
-
commitComposition: juniorGitHubPullRequests.commitComposition
|
|
1980
|
+
commitComposition: juniorGitHubPullRequests.commitComposition,
|
|
1981
|
+
conversationIds: juniorGitHubPullRequests.conversationIds
|
|
1979
1982
|
});
|
|
1980
1983
|
return {
|
|
1981
1984
|
applied: inserted.length > 0,
|
|
1982
|
-
commitComposition: inserted[0]?.commitComposition ?? void 0
|
|
1985
|
+
commitComposition: inserted[0]?.commitComposition ?? void 0,
|
|
1986
|
+
conversationIds: inserted[0]?.conversationIds ?? []
|
|
1983
1987
|
};
|
|
1984
1988
|
}
|
|
1985
1989
|
async function recordGitHubPullRequestConversations(db, input) {
|
|
@@ -2412,6 +2416,20 @@ function createGitHubWebhookRoute(args) {
|
|
|
2412
2416
|
args.db,
|
|
2413
2417
|
pullRequestOutcome
|
|
2414
2418
|
);
|
|
2419
|
+
if (recordedOutcome.applied && pullRequestOutcome.state !== "open") {
|
|
2420
|
+
const status = pullRequestOutcome.state === "merged" ? "merged" : "closed";
|
|
2421
|
+
await Promise.all(
|
|
2422
|
+
recordedOutcome.conversationIds.map(
|
|
2423
|
+
(conversationId) => args.annotations.forConversation(conversationId).upsert({
|
|
2424
|
+
kind: "resource_link",
|
|
2425
|
+
key: `${pullRequestOutcome.repositoryFullName.toLowerCase()}#${pullRequestOutcome.number}`,
|
|
2426
|
+
label: `${pullRequestOutcome.repositoryFullName}#${pullRequestOutcome.number}`,
|
|
2427
|
+
url: `https://github.com/${pullRequestOutcome.repositoryFullName}/pull/${pullRequestOutcome.number}`,
|
|
2428
|
+
status
|
|
2429
|
+
})
|
|
2430
|
+
)
|
|
2431
|
+
);
|
|
2432
|
+
}
|
|
2415
2433
|
if (recordedOutcome.applied && !recordedOutcome.commitComposition && pullRequestOutcome.state === "merged" && args.classifyPullRequestCommits) {
|
|
2416
2434
|
let commitComposition;
|
|
2417
2435
|
try {
|
|
@@ -4632,6 +4650,7 @@ function githubPlugin(options = {}) {
|
|
|
4632
4650
|
routes(ctx) {
|
|
4633
4651
|
return [
|
|
4634
4652
|
createGitHubWebhookRoute({
|
|
4653
|
+
annotations: ctx.annotations,
|
|
4635
4654
|
botEmail: () => readEnv(botEmailEnv),
|
|
4636
4655
|
classifyPullRequestCommits: async ({
|
|
4637
4656
|
number,
|
|
@@ -44,6 +44,7 @@ export type GitHubPullRequestLinkedIssuesInput = z.output<typeof githubPullReque
|
|
|
44
44
|
export declare function recordGitHubPullRequestOutcome(db: GitHubDb, input: GitHubPullRequestOutcomeInput): Promise<{
|
|
45
45
|
applied: boolean;
|
|
46
46
|
commitComposition: GitHubPullRequestCommitComposition | undefined;
|
|
47
|
+
conversationIds: string[];
|
|
47
48
|
}>;
|
|
48
49
|
/** Append native conversation ids to an existing Junior-owned PR projection. */
|
|
49
50
|
export declare function recordGitHubPullRequestConversations(db: GitHubDb, input: GitHubPullRequestConversationsInput): Promise<boolean>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { PluginLogger, PluginRoute, ResourceEventPublisher } from "@sentry/junior-plugin-api";
|
|
1
|
+
import type { PluginConversationAnnotations, PluginLogger, PluginRoute, ResourceEventPublisher } from "@sentry/junior-plugin-api";
|
|
2
2
|
import type { GitHubDb } from "../db/database.js";
|
|
3
3
|
import type { GitHubPullRequestCommitComposition } from "../db/schema.js";
|
|
4
4
|
import { type GitHubFailingCheck } from "./resource-events.js";
|
|
5
5
|
/** Create the public, signed GitHub webhook route owned by the plugin. */
|
|
6
6
|
export declare function createGitHubWebhookRoute(args: {
|
|
7
|
+
annotations: PluginConversationAnnotations;
|
|
7
8
|
botEmail(): string | undefined;
|
|
8
9
|
classifyPullRequestCommits?(input: {
|
|
9
10
|
number: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.152.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.152.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.9.1",
|