@sentry/junior-github 0.276.0 → 0.277.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/{chunk-PCWKGWHE.js → chunk-IR7D5MR7.js} +30 -4
- package/dist/github-status.d.ts +16 -0
- package/dist/index.js +459 -341
- package/dist/pull-request-outcomes/store.d.ts +7 -2
- package/dist/testing.js +1 -1
- package/dist/tools/get-status.d.ts +137 -0
- package/dist/webhooks/check-suite.d.ts +6 -0
- package/dist/webhooks/handler.d.ts +3 -0
- package/package.json +2 -2
- package/skills/github-code/SKILL.md +5 -5
- package/skills/github-code/SPEC.md +1 -0
- package/skills/github-code/references/troubleshooting-workarounds.md +15 -1
- package/skills/github-issues/references/troubleshooting-workarounds.md +1 -1
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
readGrantPermissions,
|
|
60
60
|
requireEnv,
|
|
61
61
|
resolveUserAccount
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-IR7D5MR7.js";
|
|
63
63
|
|
|
64
64
|
// src/tool-support/attribution.ts
|
|
65
65
|
var GITHUB_REQUEST_ATTRIBUTION_START = "<!-- junior-request-attribution:start -->";
|
|
@@ -2346,37 +2346,146 @@ function createGitHubGetRepositoryTool(ctx) {
|
|
|
2346
2346
|
});
|
|
2347
2347
|
}
|
|
2348
2348
|
|
|
2349
|
-
// src/tools/
|
|
2349
|
+
// src/tools/get-status.ts
|
|
2350
2350
|
import {
|
|
2351
2351
|
definePluginTool as definePluginTool8,
|
|
2352
|
+
pluginToolOutputSchema as pluginToolOutputSchema8
|
|
2353
|
+
} from "@sentry/junior-plugin-api";
|
|
2354
|
+
import { z as z12 } from "zod";
|
|
2355
|
+
|
|
2356
|
+
// src/github-status.ts
|
|
2357
|
+
import { z as z11 } from "zod";
|
|
2358
|
+
var GITHUB_STATUS_INCIDENTS_URL = "https://www.githubstatus.com/api/v2/incidents.json";
|
|
2359
|
+
var GITHUB_STATUS_TTL_MS = 60 * 1e3;
|
|
2360
|
+
var GITHUB_STATUS_TIMEOUT_MS = 5e3;
|
|
2361
|
+
var incidentsResponseSchema = z11.object({
|
|
2362
|
+
incidents: z11.array(
|
|
2363
|
+
z11.object({
|
|
2364
|
+
components: z11.array(z11.object({ name: z11.string() })).default([]),
|
|
2365
|
+
created_at: z11.string(),
|
|
2366
|
+
impact: z11.string(),
|
|
2367
|
+
name: z11.string(),
|
|
2368
|
+
resolved_at: z11.string().nullable(),
|
|
2369
|
+
shortlink: z11.string(),
|
|
2370
|
+
started_at: z11.string().nullable().optional(),
|
|
2371
|
+
status: z11.string()
|
|
2372
|
+
})
|
|
2373
|
+
)
|
|
2374
|
+
});
|
|
2375
|
+
async function fetchGitHubStatusIncidents() {
|
|
2376
|
+
const response = await fetch(GITHUB_STATUS_INCIDENTS_URL, {
|
|
2377
|
+
headers: { Accept: "application/json" },
|
|
2378
|
+
signal: AbortSignal.timeout(GITHUB_STATUS_TIMEOUT_MS)
|
|
2379
|
+
});
|
|
2380
|
+
if (!response.ok) {
|
|
2381
|
+
throw new Error(`githubstatus.com returned HTTP ${response.status}`);
|
|
2382
|
+
}
|
|
2383
|
+
const parsed = incidentsResponseSchema.parse(await response.json());
|
|
2384
|
+
return parsed.incidents.map((incident) => {
|
|
2385
|
+
const result = {
|
|
2386
|
+
components: incident.components.map((component) => component.name),
|
|
2387
|
+
impact: incident.impact,
|
|
2388
|
+
name: incident.name,
|
|
2389
|
+
startedAt: incident.started_at ?? incident.created_at,
|
|
2390
|
+
status: incident.status,
|
|
2391
|
+
url: incident.shortlink
|
|
2392
|
+
};
|
|
2393
|
+
if (incident.resolved_at) result.resolvedAt = incident.resolved_at;
|
|
2394
|
+
return result;
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2397
|
+
async function loadGitHubStatusIncidents(cache, withinMs) {
|
|
2398
|
+
const incidents = await cache.getOrLoad(
|
|
2399
|
+
"githubstatus:incidents",
|
|
2400
|
+
async () => ({
|
|
2401
|
+
ttlMs: GITHUB_STATUS_TTL_MS,
|
|
2402
|
+
value: await fetchGitHubStatusIncidents()
|
|
2403
|
+
})
|
|
2404
|
+
);
|
|
2405
|
+
const since = Date.now() - withinMs;
|
|
2406
|
+
return incidents.filter(
|
|
2407
|
+
(incident) => !incident.resolvedAt || Date.parse(incident.resolvedAt) >= since
|
|
2408
|
+
);
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
// src/tools/get-status.ts
|
|
2412
|
+
var RECENT_INCIDENT_MS = 24 * 60 * 60 * 1e3;
|
|
2413
|
+
var inputSchema6 = z12.object({}).strict();
|
|
2414
|
+
var incidentSchema = z12.object({
|
|
2415
|
+
components: z12.array(z12.string()),
|
|
2416
|
+
impact: z12.string(),
|
|
2417
|
+
name: z12.string(),
|
|
2418
|
+
resolved_at: z12.string().optional(),
|
|
2419
|
+
started_at: z12.string(),
|
|
2420
|
+
status: z12.string(),
|
|
2421
|
+
url: z12.string()
|
|
2422
|
+
});
|
|
2423
|
+
var outputSchema6 = pluginToolOutputSchema8.extend({
|
|
2424
|
+
target: z12.literal("getStatus"),
|
|
2425
|
+
incidents: z12.array(incidentSchema)
|
|
2426
|
+
});
|
|
2427
|
+
function createGitHubGetStatusTool(ctx) {
|
|
2428
|
+
return definePluginTool8({
|
|
2429
|
+
annotations: {
|
|
2430
|
+
destructiveHint: false,
|
|
2431
|
+
idempotentHint: true,
|
|
2432
|
+
openWorldHint: true,
|
|
2433
|
+
readOnlyHint: true
|
|
2434
|
+
},
|
|
2435
|
+
description: "List GitHub incidents from githubstatus.com that are open or were resolved in the last 24 hours, with their affected components. Use when a GitHub request fails with a 5xx, a timeout, or a dropped connection, or when checks stay queued or fail with no cause in the logs.",
|
|
2436
|
+
inputSchema: inputSchema6,
|
|
2437
|
+
outputSchema: outputSchema6,
|
|
2438
|
+
async execute() {
|
|
2439
|
+
const incidents = await loadGitHubStatusIncidents(
|
|
2440
|
+
ctx.cache,
|
|
2441
|
+
RECENT_INCIDENT_MS
|
|
2442
|
+
);
|
|
2443
|
+
return {
|
|
2444
|
+
target: "getStatus",
|
|
2445
|
+
incidents: incidents.map(({ resolvedAt, startedAt, ...incident }) => {
|
|
2446
|
+
const result = {
|
|
2447
|
+
...incident,
|
|
2448
|
+
started_at: startedAt
|
|
2449
|
+
};
|
|
2450
|
+
if (resolvedAt) result.resolved_at = resolvedAt;
|
|
2451
|
+
return result;
|
|
2452
|
+
})
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
});
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
// src/tools/update-issue.ts
|
|
2459
|
+
import {
|
|
2460
|
+
definePluginTool as definePluginTool9,
|
|
2352
2461
|
PluginToolInputError as PluginToolInputError9,
|
|
2353
|
-
pluginToolOutputSchema as
|
|
2462
|
+
pluginToolOutputSchema as pluginToolOutputSchema9,
|
|
2354
2463
|
subscribableResourceSchema as subscribableResourceSchema7
|
|
2355
2464
|
} from "@sentry/junior-plugin-api";
|
|
2356
|
-
import { z as
|
|
2357
|
-
var
|
|
2358
|
-
repo:
|
|
2359
|
-
number:
|
|
2360
|
-
title:
|
|
2361
|
-
body:
|
|
2465
|
+
import { z as z13 } from "zod";
|
|
2466
|
+
var inputSchema7 = z13.object({
|
|
2467
|
+
repo: z13.string().describe('Repository in "owner/name" format.'),
|
|
2468
|
+
number: z13.number().int().positive().describe("Issue number."),
|
|
2469
|
+
title: z13.string().trim().min(1).optional().describe("Replacement issue title."),
|
|
2470
|
+
body: z13.string().optional().describe(
|
|
2362
2471
|
"Replacement issue body. The runtime appends requester attribution and the conversation footer."
|
|
2363
2472
|
),
|
|
2364
|
-
state:
|
|
2473
|
+
state: z13.enum(["open", "closed"]).optional().describe("Replacement issue state.")
|
|
2365
2474
|
}).strict().refine(
|
|
2366
2475
|
({ title, body, state }) => title !== void 0 || body !== void 0 || state !== void 0,
|
|
2367
2476
|
{ message: "At least one issue field must be provided." }
|
|
2368
2477
|
);
|
|
2369
|
-
var issueSchema =
|
|
2370
|
-
body:
|
|
2371
|
-
number:
|
|
2372
|
-
state:
|
|
2478
|
+
var issueSchema = z13.object({
|
|
2479
|
+
body: z13.string().nullable(),
|
|
2480
|
+
number: z13.number(),
|
|
2481
|
+
state: z13.string(),
|
|
2373
2482
|
subscribable: subscribableResourceSchema7.optional(),
|
|
2374
|
-
title:
|
|
2375
|
-
url:
|
|
2483
|
+
title: z13.string(),
|
|
2484
|
+
url: z13.string()
|
|
2376
2485
|
});
|
|
2377
|
-
var
|
|
2486
|
+
var outputSchema7 = pluginToolOutputSchema9.merge(
|
|
2378
2487
|
issueSchema.extend({
|
|
2379
|
-
target:
|
|
2488
|
+
target: z13.literal("updateIssue")
|
|
2380
2489
|
})
|
|
2381
2490
|
);
|
|
2382
2491
|
function nonEmptyString4(value, name) {
|
|
@@ -2408,7 +2517,7 @@ function githubApiErrorMessage3(payload) {
|
|
|
2408
2517
|
return "GitHub request failed";
|
|
2409
2518
|
}
|
|
2410
2519
|
function createGitHubUpdateIssueTool(ctx) {
|
|
2411
|
-
return
|
|
2520
|
+
return definePluginTool9({
|
|
2412
2521
|
annotations: {
|
|
2413
2522
|
destructiveHint: true,
|
|
2414
2523
|
idempotentHint: true,
|
|
@@ -2416,10 +2525,10 @@ function createGitHubUpdateIssueTool(ctx) {
|
|
|
2416
2525
|
readOnlyHint: false
|
|
2417
2526
|
},
|
|
2418
2527
|
description: "Update an existing GitHub issue's title, body, or open/closed state. Use this instead of raw GitHub API calls when changing issue metadata.",
|
|
2419
|
-
inputSchema:
|
|
2420
|
-
outputSchema:
|
|
2528
|
+
inputSchema: inputSchema7,
|
|
2529
|
+
outputSchema: outputSchema7,
|
|
2421
2530
|
async execute(input) {
|
|
2422
|
-
const parsedInput =
|
|
2531
|
+
const parsedInput = inputSchema7.safeParse(input);
|
|
2423
2532
|
if (!parsedInput.success) {
|
|
2424
2533
|
throw new PluginToolInputError9("Invalid GitHub updateIssue input.", {
|
|
2425
2534
|
cause: parsedInput.error
|
|
@@ -2464,12 +2573,12 @@ function createGitHubUpdateIssueTool(ctx) {
|
|
|
2464
2573
|
`GitHub issue update failed with HTTP ${response.status}: ${githubApiErrorMessage3(parsed)}`
|
|
2465
2574
|
);
|
|
2466
2575
|
}
|
|
2467
|
-
const providerResult =
|
|
2468
|
-
body:
|
|
2469
|
-
html_url:
|
|
2470
|
-
number:
|
|
2471
|
-
state:
|
|
2472
|
-
title:
|
|
2576
|
+
const providerResult = z13.object({
|
|
2577
|
+
body: z13.string().nullable().optional().default(null),
|
|
2578
|
+
html_url: z13.string(),
|
|
2579
|
+
number: z13.number(),
|
|
2580
|
+
state: z13.string(),
|
|
2581
|
+
title: z13.string()
|
|
2473
2582
|
}).parse(parsed);
|
|
2474
2583
|
const subscribable = gitHubIssueSubscribable({
|
|
2475
2584
|
canSubscribe: ctx.events.canSubscribe,
|
|
@@ -2502,22 +2611,22 @@ function createGitHubUpdateIssueTool(ctx) {
|
|
|
2502
2611
|
|
|
2503
2612
|
// src/tools/update-pull-request.ts
|
|
2504
2613
|
import {
|
|
2505
|
-
definePluginTool as
|
|
2614
|
+
definePluginTool as definePluginTool10,
|
|
2506
2615
|
PluginToolInputError as PluginToolInputError10,
|
|
2507
|
-
pluginToolOutputSchema as
|
|
2616
|
+
pluginToolOutputSchema as pluginToolOutputSchema10
|
|
2508
2617
|
} from "@sentry/junior-plugin-api";
|
|
2509
|
-
import { z as
|
|
2618
|
+
import { z as z14 } from "zod";
|
|
2510
2619
|
import { subscribableResourceSchema as subscribableResourceSchema8 } from "@sentry/junior-plugin-api";
|
|
2511
|
-
var
|
|
2512
|
-
repo:
|
|
2513
|
-
number:
|
|
2514
|
-
title:
|
|
2515
|
-
body:
|
|
2620
|
+
var inputSchema8 = z14.object({
|
|
2621
|
+
repo: z14.string().describe('Repository in "owner/name" format.'),
|
|
2622
|
+
number: z14.number().int().positive().describe("Pull request number."),
|
|
2623
|
+
title: z14.string().trim().min(1).optional().describe("Replacement pull request title."),
|
|
2624
|
+
body: z14.string().optional().describe(
|
|
2516
2625
|
"Replacement pull request body. The runtime appends requester attribution and the conversation footer."
|
|
2517
2626
|
),
|
|
2518
|
-
base:
|
|
2519
|
-
state:
|
|
2520
|
-
draft:
|
|
2627
|
+
base: z14.string().trim().min(1).optional().describe("Replacement base branch."),
|
|
2628
|
+
state: z14.enum(["open", "closed"]).optional().describe("Replacement pull request state."),
|
|
2629
|
+
draft: z14.boolean().optional().describe(
|
|
2521
2630
|
"Set false to mark a draft pull request ready for review, or true to convert it back to a draft."
|
|
2522
2631
|
)
|
|
2523
2632
|
}).strict().refine(
|
|
@@ -2532,27 +2641,27 @@ var CONVERT_TO_DRAFT = {
|
|
|
2532
2641
|
operationName: "ConvertPullRequestToDraft",
|
|
2533
2642
|
query: "mutation ConvertPullRequestToDraft($id: ID!) { result: convertPullRequestToDraft(input: {pullRequestId: $id}) { pullRequest { isDraft } } }"
|
|
2534
2643
|
};
|
|
2535
|
-
var draftMutationResponseSchema =
|
|
2536
|
-
data:
|
|
2537
|
-
result:
|
|
2644
|
+
var draftMutationResponseSchema = z14.object({
|
|
2645
|
+
data: z14.object({
|
|
2646
|
+
result: z14.object({ pullRequest: z14.object({ isDraft: z14.boolean() }) })
|
|
2538
2647
|
})
|
|
2539
2648
|
});
|
|
2540
|
-
var graphqlErrorsSchema =
|
|
2541
|
-
errors:
|
|
2649
|
+
var graphqlErrorsSchema = z14.object({
|
|
2650
|
+
errors: z14.array(z14.object({ message: z14.string() })).min(1)
|
|
2542
2651
|
});
|
|
2543
|
-
var pullRequestSchema2 =
|
|
2544
|
-
base:
|
|
2545
|
-
body:
|
|
2546
|
-
draft:
|
|
2547
|
-
number:
|
|
2548
|
-
state:
|
|
2652
|
+
var pullRequestSchema2 = z14.object({
|
|
2653
|
+
base: z14.string(),
|
|
2654
|
+
body: z14.string().nullable(),
|
|
2655
|
+
draft: z14.boolean(),
|
|
2656
|
+
number: z14.number(),
|
|
2657
|
+
state: z14.string(),
|
|
2549
2658
|
subscribable: subscribableResourceSchema8.optional(),
|
|
2550
|
-
title:
|
|
2551
|
-
url:
|
|
2659
|
+
title: z14.string(),
|
|
2660
|
+
url: z14.string()
|
|
2552
2661
|
});
|
|
2553
|
-
var
|
|
2662
|
+
var outputSchema8 = pluginToolOutputSchema10.merge(
|
|
2554
2663
|
pullRequestSchema2.extend({
|
|
2555
|
-
target:
|
|
2664
|
+
target: z14.literal("updatePullRequest")
|
|
2556
2665
|
})
|
|
2557
2666
|
);
|
|
2558
2667
|
function nonEmptyString5(value, name) {
|
|
@@ -2614,7 +2723,7 @@ function githubGraphqlErrorMessage(payload) {
|
|
|
2614
2723
|
return result.success ? result.data.errors.map((error) => error.message).join("; ") : githubApiErrorMessage4(payload);
|
|
2615
2724
|
}
|
|
2616
2725
|
function createGitHubUpdatePullRequestTool(ctx) {
|
|
2617
|
-
return
|
|
2726
|
+
return definePluginTool10({
|
|
2618
2727
|
annotations: {
|
|
2619
2728
|
destructiveHint: true,
|
|
2620
2729
|
idempotentHint: true,
|
|
@@ -2622,10 +2731,10 @@ function createGitHubUpdatePullRequestTool(ctx) {
|
|
|
2622
2731
|
readOnlyHint: false
|
|
2623
2732
|
},
|
|
2624
2733
|
description: "Update an existing GitHub pull request's title, body, base branch, open/closed state, or draft state. Use this instead of raw GitHub API calls when changing PR metadata or marking a PR ready for review.",
|
|
2625
|
-
inputSchema:
|
|
2626
|
-
outputSchema:
|
|
2734
|
+
inputSchema: inputSchema8,
|
|
2735
|
+
outputSchema: outputSchema8,
|
|
2627
2736
|
async execute(input) {
|
|
2628
|
-
const parsedInput =
|
|
2737
|
+
const parsedInput = inputSchema8.safeParse(input);
|
|
2629
2738
|
if (!parsedInput.success) {
|
|
2630
2739
|
throw new PluginToolInputError10(
|
|
2631
2740
|
"Invalid GitHub updatePullRequest input.",
|
|
@@ -2668,16 +2777,16 @@ function createGitHubUpdatePullRequestTool(ctx) {
|
|
|
2668
2777
|
`GitHub pull request update failed with HTTP ${response.status}: ${githubApiErrorMessage4(parsed)}`
|
|
2669
2778
|
);
|
|
2670
2779
|
}
|
|
2671
|
-
const providerResult =
|
|
2672
|
-
base:
|
|
2673
|
-
body:
|
|
2674
|
-
draft:
|
|
2675
|
-
html_url:
|
|
2676
|
-
merged:
|
|
2677
|
-
node_id:
|
|
2678
|
-
number:
|
|
2679
|
-
state:
|
|
2680
|
-
title:
|
|
2780
|
+
const providerResult = z14.object({
|
|
2781
|
+
base: z14.object({ ref: z14.string() }),
|
|
2782
|
+
body: z14.string().nullable().optional().default(null),
|
|
2783
|
+
draft: z14.boolean(),
|
|
2784
|
+
html_url: z14.string(),
|
|
2785
|
+
merged: z14.boolean(),
|
|
2786
|
+
node_id: z14.string().optional(),
|
|
2787
|
+
number: z14.number(),
|
|
2788
|
+
state: z14.string(),
|
|
2789
|
+
title: z14.string()
|
|
2681
2790
|
}).parse(parsed);
|
|
2682
2791
|
if (update.draft !== void 0 && update.draft !== providerResult.draft) {
|
|
2683
2792
|
if (!providerResult.node_id) {
|
|
@@ -2738,11 +2847,11 @@ function createGitHubUpdatePullRequestTool(ctx) {
|
|
|
2738
2847
|
|
|
2739
2848
|
// src/tools/update-pull-request-feedback.ts
|
|
2740
2849
|
import {
|
|
2741
|
-
definePluginTool as
|
|
2850
|
+
definePluginTool as definePluginTool11,
|
|
2742
2851
|
PluginToolInputError as PluginToolInputError11,
|
|
2743
|
-
pluginToolOutputSchema as
|
|
2852
|
+
pluginToolOutputSchema as pluginToolOutputSchema11
|
|
2744
2853
|
} from "@sentry/junior-plugin-api";
|
|
2745
|
-
import { z as
|
|
2854
|
+
import { z as z15 } from "zod";
|
|
2746
2855
|
var STATUS_TO_REACTION_CONTENT = {
|
|
2747
2856
|
reviewing: "eyes",
|
|
2748
2857
|
addressed: "+1",
|
|
@@ -2751,24 +2860,24 @@ var STATUS_TO_REACTION_CONTENT = {
|
|
|
2751
2860
|
var FEEDBACK_REACTION_CONTENTS = new Set(
|
|
2752
2861
|
Object.values(STATUS_TO_REACTION_CONTENT)
|
|
2753
2862
|
);
|
|
2754
|
-
var
|
|
2755
|
-
repo:
|
|
2756
|
-
comment_kind:
|
|
2863
|
+
var inputSchema9 = z15.object({
|
|
2864
|
+
repo: z15.string().describe('Repository in "owner/name" format.'),
|
|
2865
|
+
comment_kind: z15.enum(["conversation", "review"]).describe(
|
|
2757
2866
|
'Comment kind: "conversation" for a pull request conversation comment, "review" for an inline review comment.'
|
|
2758
2867
|
),
|
|
2759
|
-
comment_id:
|
|
2868
|
+
comment_id: z15.number().int().positive().describe(
|
|
2760
2869
|
"GitHub comment id (conversation comment id or inline review comment id)."
|
|
2761
2870
|
),
|
|
2762
|
-
status:
|
|
2871
|
+
status: z15.enum(["addressed", "declined"]).describe(
|
|
2763
2872
|
"Feedback outcome. Maps to a reaction: addressed -> +1, declined -> -1."
|
|
2764
2873
|
)
|
|
2765
2874
|
}).strict();
|
|
2766
|
-
var
|
|
2767
|
-
target:
|
|
2768
|
-
repo:
|
|
2769
|
-
comment_id:
|
|
2770
|
-
status:
|
|
2771
|
-
reaction_id:
|
|
2875
|
+
var outputSchema9 = pluginToolOutputSchema11.extend({
|
|
2876
|
+
target: z15.literal("updatePullRequestFeedback"),
|
|
2877
|
+
repo: z15.string(),
|
|
2878
|
+
comment_id: z15.number(),
|
|
2879
|
+
status: z15.enum(["addressed", "declined"]),
|
|
2880
|
+
reaction_id: z15.number()
|
|
2772
2881
|
});
|
|
2773
2882
|
function parseRepo10(value) {
|
|
2774
2883
|
const parts = value.split("/").map((part) => part.trim());
|
|
@@ -2803,10 +2912,10 @@ function githubError(payload) {
|
|
|
2803
2912
|
}
|
|
2804
2913
|
return "GitHub request failed";
|
|
2805
2914
|
}
|
|
2806
|
-
var reactionSchema =
|
|
2807
|
-
id:
|
|
2808
|
-
content:
|
|
2809
|
-
user:
|
|
2915
|
+
var reactionSchema = z15.object({
|
|
2916
|
+
id: z15.number(),
|
|
2917
|
+
content: z15.string(),
|
|
2918
|
+
user: z15.object({ id: z15.number() }).nullable()
|
|
2810
2919
|
});
|
|
2811
2920
|
async function assertBotAuthoredPullRequest(egress, input) {
|
|
2812
2921
|
const headers = {
|
|
@@ -2827,9 +2936,9 @@ async function assertBotAuthoredPullRequest(egress, input) {
|
|
|
2827
2936
|
if (commentResponse.status === 404) throw new PluginToolInputError11(message);
|
|
2828
2937
|
throw new Error(message);
|
|
2829
2938
|
}
|
|
2830
|
-
const comment =
|
|
2831
|
-
issue_url:
|
|
2832
|
-
pull_request_url:
|
|
2939
|
+
const comment = z15.object({
|
|
2940
|
+
issue_url: z15.string().optional(),
|
|
2941
|
+
pull_request_url: z15.string().optional()
|
|
2833
2942
|
}).safeParse(commentPayload);
|
|
2834
2943
|
const parentUrl = comment.success ? input.commentKind === "conversation" ? comment.data.issue_url : comment.data.pull_request_url : void 0;
|
|
2835
2944
|
const number = /\/(?:issues|pulls)\/(\d+)$/.exec(parentUrl ?? "")?.[1];
|
|
@@ -2850,7 +2959,7 @@ async function assertBotAuthoredPullRequest(egress, input) {
|
|
|
2850
2959
|
`GitHub pull request lookup failed with HTTP ${pullResponse.status}: ${githubError(pullPayload)}`
|
|
2851
2960
|
);
|
|
2852
2961
|
}
|
|
2853
|
-
const pull =
|
|
2962
|
+
const pull = z15.object({ user: z15.object({ id: z15.number() }).nullable() }).safeParse(pullPayload);
|
|
2854
2963
|
if (!pullResponse.ok || !pull.success || pull.data.user?.id !== input.botUserId) {
|
|
2855
2964
|
throw new PluginToolInputError11(
|
|
2856
2965
|
"This bot can only set feedback status on comments on pull requests it authored."
|
|
@@ -2858,7 +2967,7 @@ async function assertBotAuthoredPullRequest(egress, input) {
|
|
|
2858
2967
|
}
|
|
2859
2968
|
}
|
|
2860
2969
|
function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
|
|
2861
|
-
return
|
|
2970
|
+
return definePluginTool11({
|
|
2862
2971
|
// No action review: the tool checks in code that the bot authored the pull
|
|
2863
2972
|
// request, and it changes only the bot's own reaction, which is reversible.
|
|
2864
2973
|
approvalMode: "approve",
|
|
@@ -2870,10 +2979,10 @@ function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
|
|
|
2870
2979
|
},
|
|
2871
2980
|
description: "Set your outcome reaction on GitHub pull request feedback: addressed (+1) or declined (-1). Use the comment_id and comment_kind from the event after acting on the feedback. Replaces only your prior status reaction on that comment. Only works on pull requests the bot authored.",
|
|
2872
2981
|
exposure: "direct",
|
|
2873
|
-
inputSchema:
|
|
2874
|
-
outputSchema:
|
|
2982
|
+
inputSchema: inputSchema9,
|
|
2983
|
+
outputSchema: outputSchema9,
|
|
2875
2984
|
async execute(input) {
|
|
2876
|
-
const parsedInput =
|
|
2985
|
+
const parsedInput = inputSchema9.safeParse(input);
|
|
2877
2986
|
if (!parsedInput.success) {
|
|
2878
2987
|
throw new PluginToolInputError11(
|
|
2879
2988
|
"Invalid GitHub updatePullRequestFeedback input.",
|
|
@@ -2917,7 +3026,7 @@ function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
|
|
|
2917
3026
|
`GitHub reaction lookup failed with HTTP ${listResponse.status}: ${githubError(listPayload)}`
|
|
2918
3027
|
);
|
|
2919
3028
|
}
|
|
2920
|
-
const botReactions =
|
|
3029
|
+
const botReactions = z15.array(reactionSchema).parse(listPayload).filter(
|
|
2921
3030
|
(reaction) => reaction.user?.id === botUserId && FEEDBACK_REACTION_CONTENTS.has(reaction.content)
|
|
2922
3031
|
);
|
|
2923
3032
|
const existing = botReactions.find(
|
|
@@ -2980,25 +3089,25 @@ function createGitHubUpdatePullRequestFeedbackTool(ctx, botEmail) {
|
|
|
2980
3089
|
|
|
2981
3090
|
// src/tools/resolve-pull-request-review-thread.ts
|
|
2982
3091
|
import {
|
|
2983
|
-
definePluginTool as
|
|
3092
|
+
definePluginTool as definePluginTool12,
|
|
2984
3093
|
PluginToolInputError as PluginToolInputError12,
|
|
2985
|
-
pluginToolOutputSchema as
|
|
3094
|
+
pluginToolOutputSchema as pluginToolOutputSchema12
|
|
2986
3095
|
} from "@sentry/junior-plugin-api";
|
|
2987
|
-
import { z as
|
|
2988
|
-
var
|
|
2989
|
-
repo:
|
|
3096
|
+
import { z as z16 } from "zod";
|
|
3097
|
+
var inputSchema10 = z16.object({
|
|
3098
|
+
repo: z16.string().describe(
|
|
2990
3099
|
'Repository in "owner/name" format. Required because GraphQL has no repo path.'
|
|
2991
3100
|
),
|
|
2992
|
-
thread_id:
|
|
3101
|
+
thread_id: z16.string().trim().min(1).describe(
|
|
2993
3102
|
"GitHub pull request review thread node ID (the `threadId` / `id` variable used by `gh api graphql` resolveReviewThread)."
|
|
2994
3103
|
)
|
|
2995
3104
|
}).strict();
|
|
2996
|
-
var
|
|
2997
|
-
target:
|
|
2998
|
-
repo:
|
|
2999
|
-
number:
|
|
3000
|
-
thread_id:
|
|
3001
|
-
resolved:
|
|
3105
|
+
var outputSchema10 = pluginToolOutputSchema12.extend({
|
|
3106
|
+
target: z16.literal("resolvePullRequestReviewThread"),
|
|
3107
|
+
repo: z16.string(),
|
|
3108
|
+
number: z16.number(),
|
|
3109
|
+
thread_id: z16.string(),
|
|
3110
|
+
resolved: z16.boolean()
|
|
3002
3111
|
});
|
|
3003
3112
|
function parseRepo11(value) {
|
|
3004
3113
|
const parts = value.split("/").map((part) => part.trim());
|
|
@@ -3024,7 +3133,7 @@ function githubError2(payload) {
|
|
|
3024
3133
|
return "GitHub request failed";
|
|
3025
3134
|
}
|
|
3026
3135
|
function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
|
|
3027
|
-
return
|
|
3136
|
+
return definePluginTool12({
|
|
3028
3137
|
// No action review: the tool checks in code that the bot authored the pull
|
|
3029
3138
|
// request, and it changes only the thread's resolved state, which is
|
|
3030
3139
|
// reversible.
|
|
@@ -3037,10 +3146,10 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
|
|
|
3037
3146
|
},
|
|
3038
3147
|
description: "Resolve a GitHub pull request review thread after acting on its feedback. Only works on pull requests the bot authored.",
|
|
3039
3148
|
exposure: "direct",
|
|
3040
|
-
inputSchema:
|
|
3041
|
-
outputSchema:
|
|
3149
|
+
inputSchema: inputSchema10,
|
|
3150
|
+
outputSchema: outputSchema10,
|
|
3042
3151
|
async execute(input) {
|
|
3043
|
-
const parsedInput =
|
|
3152
|
+
const parsedInput = inputSchema10.safeParse(input);
|
|
3044
3153
|
if (!parsedInput.success) {
|
|
3045
3154
|
throw new PluginToolInputError12(
|
|
3046
3155
|
"Invalid GitHub resolvePullRequestReviewThread input.",
|
|
@@ -3084,18 +3193,18 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
|
|
|
3084
3193
|
`GitHub review thread lookup failed with HTTP ${lookupResponse.status}: ${githubError2(lookupPayload)}`
|
|
3085
3194
|
);
|
|
3086
3195
|
}
|
|
3087
|
-
const threadNodeSchema =
|
|
3088
|
-
id:
|
|
3089
|
-
isResolved:
|
|
3090
|
-
pullRequest:
|
|
3091
|
-
author:
|
|
3092
|
-
number:
|
|
3093
|
-
repository:
|
|
3196
|
+
const threadNodeSchema = z16.object({
|
|
3197
|
+
id: z16.string(),
|
|
3198
|
+
isResolved: z16.boolean(),
|
|
3199
|
+
pullRequest: z16.object({
|
|
3200
|
+
author: z16.object({ databaseId: z16.number().optional() }).passthrough().nullable(),
|
|
3201
|
+
number: z16.number(),
|
|
3202
|
+
repository: z16.object({ nameWithOwner: z16.string() }).passthrough()
|
|
3094
3203
|
}).passthrough()
|
|
3095
3204
|
}).passthrough();
|
|
3096
|
-
const lookupResultSchema =
|
|
3097
|
-
data:
|
|
3098
|
-
node:
|
|
3205
|
+
const lookupResultSchema = z16.object({
|
|
3206
|
+
data: z16.object({
|
|
3207
|
+
node: z16.unknown().nullable().optional()
|
|
3099
3208
|
}).passthrough()
|
|
3100
3209
|
}).passthrough();
|
|
3101
3210
|
const lookupResult = lookupResultSchema.safeParse(lookupPayload);
|
|
@@ -3145,10 +3254,10 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
|
|
|
3145
3254
|
`GitHub review thread resolution failed with HTTP ${resolveResponse.status}: ${githubError2(resolvePayload)}`
|
|
3146
3255
|
);
|
|
3147
3256
|
}
|
|
3148
|
-
const resolveResultSchema =
|
|
3149
|
-
data:
|
|
3150
|
-
resolveReviewThread:
|
|
3151
|
-
thread:
|
|
3257
|
+
const resolveResultSchema = z16.object({
|
|
3258
|
+
data: z16.object({
|
|
3259
|
+
resolveReviewThread: z16.object({
|
|
3260
|
+
thread: z16.object({ id: z16.string(), isResolved: z16.boolean() }).passthrough()
|
|
3152
3261
|
}).passthrough()
|
|
3153
3262
|
}).passthrough()
|
|
3154
3263
|
}).passthrough();
|
|
@@ -3176,36 +3285,36 @@ function createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail) {
|
|
|
3176
3285
|
|
|
3177
3286
|
// src/tools/submit-pull-request-review.ts
|
|
3178
3287
|
import {
|
|
3179
|
-
definePluginTool as
|
|
3288
|
+
definePluginTool as definePluginTool13,
|
|
3180
3289
|
PluginToolInputError as PluginToolInputError13,
|
|
3181
|
-
pluginToolOutputSchema as
|
|
3290
|
+
pluginToolOutputSchema as pluginToolOutputSchema13
|
|
3182
3291
|
} from "@sentry/junior-plugin-api";
|
|
3183
|
-
import { z as
|
|
3184
|
-
var reviewCommentSchema =
|
|
3185
|
-
path:
|
|
3186
|
-
body:
|
|
3187
|
-
line:
|
|
3188
|
-
side:
|
|
3189
|
-
start_line:
|
|
3190
|
-
start_side:
|
|
3292
|
+
import { z as z17 } from "zod";
|
|
3293
|
+
var reviewCommentSchema = z17.object({
|
|
3294
|
+
path: z17.string().trim().min(1).describe("File path in the pull request."),
|
|
3295
|
+
body: z17.string().trim().min(1).describe("Inline review comment."),
|
|
3296
|
+
line: z17.number().int().positive().describe("Line in the pull request diff."),
|
|
3297
|
+
side: z17.enum(["LEFT", "RIGHT"]).describe("Side of the pull request diff."),
|
|
3298
|
+
start_line: z17.number().int().positive().optional().describe("First line of a multi-line comment."),
|
|
3299
|
+
start_side: z17.enum(["LEFT", "RIGHT"]).optional().describe("First side of a multi-line comment.")
|
|
3191
3300
|
}).strict().refine(
|
|
3192
3301
|
({ start_line, start_side }) => start_line === void 0 === (start_side === void 0),
|
|
3193
3302
|
{ message: "start_line and start_side must be provided together." }
|
|
3194
3303
|
);
|
|
3195
|
-
var
|
|
3196
|
-
repo:
|
|
3197
|
-
number:
|
|
3198
|
-
event:
|
|
3199
|
-
body:
|
|
3200
|
-
comments:
|
|
3304
|
+
var inputSchema11 = z17.object({
|
|
3305
|
+
repo: z17.string().describe('Repository in "owner/name" format.'),
|
|
3306
|
+
number: z17.number().int().positive().describe("Pull request number."),
|
|
3307
|
+
event: z17.enum(["COMMENT", "REQUEST_CHANGES"]).describe("Review result. You cannot approve pull requests."),
|
|
3308
|
+
body: z17.string().trim().min(1).describe("Review summary."),
|
|
3309
|
+
comments: z17.array(reviewCommentSchema).optional().describe("Optional inline review comments.")
|
|
3201
3310
|
}).strict();
|
|
3202
|
-
var
|
|
3203
|
-
target:
|
|
3204
|
-
repo:
|
|
3205
|
-
number:
|
|
3206
|
-
review_id:
|
|
3207
|
-
state:
|
|
3208
|
-
url:
|
|
3311
|
+
var outputSchema11 = pluginToolOutputSchema13.extend({
|
|
3312
|
+
target: z17.literal("submitPullRequestReview"),
|
|
3313
|
+
repo: z17.string(),
|
|
3314
|
+
number: z17.number(),
|
|
3315
|
+
review_id: z17.number(),
|
|
3316
|
+
state: z17.string(),
|
|
3317
|
+
url: z17.string()
|
|
3209
3318
|
});
|
|
3210
3319
|
function parseRepo12(value) {
|
|
3211
3320
|
const parts = value.split("/").map((part) => part.trim());
|
|
@@ -3239,7 +3348,7 @@ function throwReviewError(status, body) {
|
|
|
3239
3348
|
throw new Error(message);
|
|
3240
3349
|
}
|
|
3241
3350
|
function createGitHubSubmitPullRequestReviewTool(egress) {
|
|
3242
|
-
return
|
|
3351
|
+
return definePluginTool13({
|
|
3243
3352
|
annotations: {
|
|
3244
3353
|
destructiveHint: true,
|
|
3245
3354
|
idempotentHint: false,
|
|
@@ -3248,8 +3357,8 @@ function createGitHubSubmitPullRequestReviewTool(egress) {
|
|
|
3248
3357
|
},
|
|
3249
3358
|
description: "Submit a GitHub pull request review as a comment or change request. Use this instead of `gh pr review`, GraphQL, or direct REST calls. You cannot approve pull requests.",
|
|
3250
3359
|
exposure: "direct",
|
|
3251
|
-
inputSchema:
|
|
3252
|
-
outputSchema:
|
|
3360
|
+
inputSchema: inputSchema11,
|
|
3361
|
+
outputSchema: outputSchema11,
|
|
3253
3362
|
async execute(review) {
|
|
3254
3363
|
const repo = parseRepo12(review.repo);
|
|
3255
3364
|
const comments = review.comments?.map((comment) => ({
|
|
@@ -3284,7 +3393,7 @@ function createGitHubSubmitPullRequestReviewTool(egress) {
|
|
|
3284
3393
|
if (!response.ok) {
|
|
3285
3394
|
throwReviewError(response.status, parsed);
|
|
3286
3395
|
}
|
|
3287
|
-
const providerResult =
|
|
3396
|
+
const providerResult = z17.object({ id: z17.number(), html_url: z17.string(), state: z17.string() }).parse(parsed);
|
|
3288
3397
|
return {
|
|
3289
3398
|
target: "submitPullRequestReview",
|
|
3290
3399
|
repo: repo.ref,
|
|
@@ -3310,6 +3419,7 @@ function createGitHubTools(ctx, botEmail, pullRequestSubscription) {
|
|
|
3310
3419
|
getPullRequest: createGitHubGetPullRequestTool(ctx),
|
|
3311
3420
|
getRelease: createGitHubGetReleaseTool(ctx),
|
|
3312
3421
|
getRepository: createGitHubGetRepositoryTool(ctx),
|
|
3422
|
+
getStatus: createGitHubGetStatusTool(ctx),
|
|
3313
3423
|
resolvePullRequestReviewThread: createGitHubResolvePullRequestReviewThreadTool(ctx, botEmail),
|
|
3314
3424
|
submitPullRequestReview: createGitHubSubmitPullRequestReviewTool(
|
|
3315
3425
|
ctx.egress
|
|
@@ -3325,26 +3435,26 @@ function createGitHubTools(ctx, botEmail, pullRequestSubscription) {
|
|
|
3325
3435
|
|
|
3326
3436
|
// src/webhooks/handler.ts
|
|
3327
3437
|
import { createHmac, timingSafeEqual } from "crypto";
|
|
3328
|
-
import { z as
|
|
3438
|
+
import { z as z27 } from "zod";
|
|
3329
3439
|
|
|
3330
3440
|
// src/issue-outcomes/store.ts
|
|
3331
3441
|
import { and as and2, eq as eq2, lte, sql as sql2 } from "drizzle-orm";
|
|
3332
|
-
import { z as
|
|
3333
|
-
var githubIssueOutcomeInputSchema =
|
|
3334
|
-
candidateOwned:
|
|
3335
|
-
closedAt:
|
|
3336
|
-
issueId:
|
|
3337
|
-
number:
|
|
3338
|
-
openedAt:
|
|
3339
|
-
repositoryFullName:
|
|
3340
|
-
repositoryId:
|
|
3442
|
+
import { z as z18 } from "zod";
|
|
3443
|
+
var githubIssueOutcomeInputSchema = z18.object({
|
|
3444
|
+
candidateOwned: z18.boolean(),
|
|
3445
|
+
closedAt: z18.date().optional(),
|
|
3446
|
+
issueId: z18.string().min(1),
|
|
3447
|
+
number: z18.number().int().positive(),
|
|
3448
|
+
openedAt: z18.date(),
|
|
3449
|
+
repositoryFullName: z18.string().min(1),
|
|
3450
|
+
repositoryId: z18.string().min(1),
|
|
3341
3451
|
state: githubIssueStateSchema,
|
|
3342
3452
|
stateReason: githubIssueStateReasonSchema.optional(),
|
|
3343
|
-
updatedAt:
|
|
3453
|
+
updatedAt: z18.date()
|
|
3344
3454
|
}).strict();
|
|
3345
|
-
var githubIssueConversationsInputSchema =
|
|
3346
|
-
conversationIds:
|
|
3347
|
-
issueId:
|
|
3455
|
+
var githubIssueConversationsInputSchema = z18.object({
|
|
3456
|
+
conversationIds: z18.array(z18.string().min(1)).min(1),
|
|
3457
|
+
issueId: z18.string().min(1)
|
|
3348
3458
|
}).strict();
|
|
3349
3459
|
function projectionValues(input) {
|
|
3350
3460
|
return {
|
|
@@ -3408,33 +3518,33 @@ async function recordGitHubIssueConversations(db, input) {
|
|
|
3408
3518
|
|
|
3409
3519
|
// src/pull-request-outcomes/store.ts
|
|
3410
3520
|
import { and as and3, eq as eq3, lte as lte2, ne, sql as sql3 } from "drizzle-orm";
|
|
3411
|
-
import { z as
|
|
3412
|
-
var githubPullRequestOutcomeInputSchema =
|
|
3413
|
-
candidateOwned:
|
|
3414
|
-
closedAt:
|
|
3521
|
+
import { z as z19 } from "zod";
|
|
3522
|
+
var githubPullRequestOutcomeInputSchema = z19.object({
|
|
3523
|
+
candidateOwned: z19.boolean(),
|
|
3524
|
+
closedAt: z19.date().optional(),
|
|
3415
3525
|
commitComposition: githubPullRequestCommitCompositionSchema.optional(),
|
|
3416
|
-
mergedAt:
|
|
3417
|
-
number:
|
|
3418
|
-
openedAt:
|
|
3419
|
-
pullRequestId:
|
|
3420
|
-
repositoryFullName:
|
|
3421
|
-
repositoryId:
|
|
3526
|
+
mergedAt: z19.date().optional(),
|
|
3527
|
+
number: z19.number().int().positive(),
|
|
3528
|
+
openedAt: z19.date(),
|
|
3529
|
+
pullRequestId: z19.string().min(1),
|
|
3530
|
+
repositoryFullName: z19.string().min(1),
|
|
3531
|
+
repositoryId: z19.string().min(1),
|
|
3422
3532
|
state: githubPullRequestStateSchema,
|
|
3423
|
-
title:
|
|
3424
|
-
updatedAt:
|
|
3533
|
+
title: z19.string().min(1).optional(),
|
|
3534
|
+
updatedAt: z19.date()
|
|
3425
3535
|
}).strict();
|
|
3426
|
-
var githubPullRequestConversationsInputSchema =
|
|
3427
|
-
conversationIds:
|
|
3428
|
-
pullRequestId:
|
|
3536
|
+
var githubPullRequestConversationsInputSchema = z19.object({
|
|
3537
|
+
conversationIds: z19.array(z19.string().min(1)).min(1),
|
|
3538
|
+
pullRequestId: z19.string().min(1)
|
|
3429
3539
|
}).strict();
|
|
3430
|
-
var githubPullRequestLinkedIssuesInputSchema =
|
|
3431
|
-
linkedIssues:
|
|
3432
|
-
|
|
3433
|
-
number:
|
|
3434
|
-
repositoryFullName:
|
|
3540
|
+
var githubPullRequestLinkedIssuesInputSchema = z19.object({
|
|
3541
|
+
linkedIssues: z19.array(
|
|
3542
|
+
z19.object({
|
|
3543
|
+
number: z19.number().int().positive(),
|
|
3544
|
+
repositoryFullName: z19.string().min(1)
|
|
3435
3545
|
}).strict()
|
|
3436
3546
|
).min(1),
|
|
3437
|
-
pullRequestId:
|
|
3547
|
+
pullRequestId: z19.string().min(1)
|
|
3438
3548
|
}).strict();
|
|
3439
3549
|
function projectionValues2(input) {
|
|
3440
3550
|
return {
|
|
@@ -3502,7 +3612,7 @@ async function listGitHubUnfinishedWork(db, conversationIds) {
|
|
|
3502
3612
|
);
|
|
3503
3613
|
const rows = await db.select({ conversationIds: juniorGitHubPullRequests.conversationIds }).from(juniorGitHubPullRequests).where(
|
|
3504
3614
|
and3(
|
|
3505
|
-
|
|
3615
|
+
eq3(juniorGitHubPullRequests.state, "open"),
|
|
3506
3616
|
sql3`${juniorGitHubPullRequests.conversationIds} && ARRAY[${values}]::text[]`
|
|
3507
3617
|
)
|
|
3508
3618
|
);
|
|
@@ -3515,23 +3625,25 @@ async function listGitHubFinishedWork(db, conversationIds) {
|
|
|
3515
3625
|
sql3`, `
|
|
3516
3626
|
);
|
|
3517
3627
|
const rows = await db.select({
|
|
3628
|
+
closedAt: juniorGitHubPullRequests.closedAt,
|
|
3518
3629
|
conversationIds: juniorGitHubPullRequests.conversationIds,
|
|
3519
3630
|
mergedAt: juniorGitHubPullRequests.mergedAt
|
|
3520
3631
|
}).from(juniorGitHubPullRequests).where(
|
|
3521
3632
|
and3(
|
|
3522
|
-
|
|
3633
|
+
ne(juniorGitHubPullRequests.state, "open"),
|
|
3523
3634
|
sql3`${juniorGitHubPullRequests.conversationIds} && ARRAY[${values}]::text[]`
|
|
3524
3635
|
)
|
|
3525
3636
|
);
|
|
3526
3637
|
const candidates = new Set(conversationIds);
|
|
3527
3638
|
const finishedAtById = /* @__PURE__ */ new Map();
|
|
3528
3639
|
for (const row of rows) {
|
|
3529
|
-
|
|
3640
|
+
const finishedAt = row.mergedAt ?? row.closedAt;
|
|
3641
|
+
if (!finishedAt) continue;
|
|
3530
3642
|
for (const conversationId of row.conversationIds) {
|
|
3531
3643
|
if (!candidates.has(conversationId)) continue;
|
|
3532
3644
|
const current = finishedAtById.get(conversationId);
|
|
3533
|
-
if (!current ||
|
|
3534
|
-
finishedAtById.set(conversationId,
|
|
3645
|
+
if (!current || finishedAt > current) {
|
|
3646
|
+
finishedAtById.set(conversationId, finishedAt);
|
|
3535
3647
|
}
|
|
3536
3648
|
}
|
|
3537
3649
|
}
|
|
@@ -3637,39 +3749,39 @@ async function releaseGitHubPullRequestReadySync(db, target, claim) {
|
|
|
3637
3749
|
}
|
|
3638
3750
|
|
|
3639
3751
|
// src/webhooks/issue-outcome.ts
|
|
3640
|
-
import { z as
|
|
3641
|
-
var canonicalIssueOutcomeSchema =
|
|
3642
|
-
action:
|
|
3643
|
-
issue:
|
|
3644
|
-
body:
|
|
3645
|
-
closed_at:
|
|
3646
|
-
created_at:
|
|
3647
|
-
id:
|
|
3648
|
-
number:
|
|
3752
|
+
import { z as z20 } from "zod";
|
|
3753
|
+
var canonicalIssueOutcomeSchema = z20.object({
|
|
3754
|
+
action: z20.enum(["opened", "closed", "reopened"]),
|
|
3755
|
+
issue: z20.object({
|
|
3756
|
+
body: z20.string().nullable().optional(),
|
|
3757
|
+
closed_at: z20.string().nullable().optional(),
|
|
3758
|
+
created_at: z20.string(),
|
|
3759
|
+
id: z20.number().int().positive(),
|
|
3760
|
+
number: z20.number().int().positive(),
|
|
3649
3761
|
state_reason: githubIssueStateReasonSchema.nullable().optional(),
|
|
3650
|
-
updated_at:
|
|
3651
|
-
user:
|
|
3762
|
+
updated_at: z20.string(),
|
|
3763
|
+
user: z20.object({ login: z20.string().min(1) }).strict()
|
|
3652
3764
|
}).strict(),
|
|
3653
|
-
repository:
|
|
3654
|
-
full_name:
|
|
3655
|
-
id:
|
|
3765
|
+
repository: z20.object({
|
|
3766
|
+
full_name: z20.string().min(1),
|
|
3767
|
+
id: z20.number().int().positive()
|
|
3656
3768
|
}).strict()
|
|
3657
3769
|
}).strict();
|
|
3658
|
-
var issueOutcomeSchema =
|
|
3659
|
-
action:
|
|
3660
|
-
issue:
|
|
3661
|
-
body:
|
|
3662
|
-
closed_at:
|
|
3663
|
-
created_at:
|
|
3664
|
-
id:
|
|
3665
|
-
number:
|
|
3770
|
+
var issueOutcomeSchema = z20.object({
|
|
3771
|
+
action: z20.enum(["opened", "closed", "reopened"]),
|
|
3772
|
+
issue: z20.object({
|
|
3773
|
+
body: z20.string().nullable().optional(),
|
|
3774
|
+
closed_at: z20.string().nullable().optional(),
|
|
3775
|
+
created_at: z20.string(),
|
|
3776
|
+
id: z20.number().int().positive(),
|
|
3777
|
+
number: z20.number().int().positive(),
|
|
3666
3778
|
state_reason: githubIssueStateReasonSchema.nullable().optional(),
|
|
3667
|
-
updated_at:
|
|
3668
|
-
user:
|
|
3779
|
+
updated_at: z20.string(),
|
|
3780
|
+
user: z20.object({ login: z20.string().min(1) }).passthrough()
|
|
3669
3781
|
}).passthrough(),
|
|
3670
|
-
repository:
|
|
3671
|
-
full_name:
|
|
3672
|
-
id:
|
|
3782
|
+
repository: z20.object({
|
|
3783
|
+
full_name: z20.string().min(1),
|
|
3784
|
+
id: z20.number().int().positive()
|
|
3673
3785
|
}).passthrough()
|
|
3674
3786
|
}).passthrough().transform(
|
|
3675
3787
|
(provider) => canonicalIssueOutcomeSchema.parse({
|
|
@@ -3690,7 +3802,7 @@ var issueOutcomeSchema = z18.object({
|
|
|
3690
3802
|
}
|
|
3691
3803
|
})
|
|
3692
3804
|
);
|
|
3693
|
-
var issueLifecycleActionSchema =
|
|
3805
|
+
var issueLifecycleActionSchema = z20.object({ action: z20.string() }).passthrough();
|
|
3694
3806
|
function timestamp2(value) {
|
|
3695
3807
|
if (!value) return void 0;
|
|
3696
3808
|
const parsed = new Date(value);
|
|
@@ -3734,21 +3846,21 @@ function normalizeGitHubIssueOutcome(args) {
|
|
|
3734
3846
|
updatedAt
|
|
3735
3847
|
};
|
|
3736
3848
|
}
|
|
3737
|
-
var canonicalIssueConversationSchema =
|
|
3738
|
-
issue:
|
|
3739
|
-
body:
|
|
3740
|
-
id:
|
|
3741
|
-
user:
|
|
3849
|
+
var canonicalIssueConversationSchema = z20.object({
|
|
3850
|
+
issue: z20.object({
|
|
3851
|
+
body: z20.string().nullable().optional(),
|
|
3852
|
+
id: z20.number().int().positive(),
|
|
3853
|
+
user: z20.object({ login: z20.string().min(1) }).strict()
|
|
3742
3854
|
}).strict(),
|
|
3743
|
-
sender:
|
|
3855
|
+
sender: z20.object({ login: z20.string().min(1) }).strict().optional()
|
|
3744
3856
|
}).strict();
|
|
3745
|
-
var issueConversationSchema =
|
|
3746
|
-
issue:
|
|
3747
|
-
body:
|
|
3748
|
-
id:
|
|
3749
|
-
user:
|
|
3857
|
+
var issueConversationSchema = z20.object({
|
|
3858
|
+
issue: z20.object({
|
|
3859
|
+
body: z20.string().nullable().optional(),
|
|
3860
|
+
id: z20.number().int().positive(),
|
|
3861
|
+
user: z20.object({ login: z20.string().min(1) }).passthrough()
|
|
3750
3862
|
}).passthrough(),
|
|
3751
|
-
sender:
|
|
3863
|
+
sender: z20.object({ login: z20.string().min(1) }).passthrough().optional()
|
|
3752
3864
|
}).passthrough().transform(
|
|
3753
3865
|
(provider) => canonicalIssueConversationSchema.parse({
|
|
3754
3866
|
issue: {
|
|
@@ -3775,43 +3887,43 @@ function normalizeGitHubIssueConversations(args) {
|
|
|
3775
3887
|
}
|
|
3776
3888
|
|
|
3777
3889
|
// src/webhooks/pull-request-outcome.ts
|
|
3778
|
-
import { z as
|
|
3779
|
-
var canonicalPullRequestOutcomeSchema =
|
|
3780
|
-
action:
|
|
3781
|
-
pull_request:
|
|
3782
|
-
body:
|
|
3783
|
-
closed_at:
|
|
3784
|
-
created_at:
|
|
3785
|
-
id:
|
|
3786
|
-
merged:
|
|
3787
|
-
merged_at:
|
|
3788
|
-
number:
|
|
3789
|
-
title:
|
|
3790
|
-
updated_at:
|
|
3791
|
-
user:
|
|
3890
|
+
import { z as z21 } from "zod";
|
|
3891
|
+
var canonicalPullRequestOutcomeSchema = z21.object({
|
|
3892
|
+
action: z21.enum(["opened", "closed", "reopened"]),
|
|
3893
|
+
pull_request: z21.object({
|
|
3894
|
+
body: z21.string().nullable().optional(),
|
|
3895
|
+
closed_at: z21.string().nullable().optional(),
|
|
3896
|
+
created_at: z21.string(),
|
|
3897
|
+
id: z21.number().int().positive(),
|
|
3898
|
+
merged: z21.boolean(),
|
|
3899
|
+
merged_at: z21.string().nullable().optional(),
|
|
3900
|
+
number: z21.number().int().positive(),
|
|
3901
|
+
title: z21.string().min(1).optional(),
|
|
3902
|
+
updated_at: z21.string(),
|
|
3903
|
+
user: z21.object({ login: z21.string().min(1) }).strict()
|
|
3792
3904
|
}).strict(),
|
|
3793
|
-
repository:
|
|
3794
|
-
full_name:
|
|
3795
|
-
id:
|
|
3905
|
+
repository: z21.object({
|
|
3906
|
+
full_name: z21.string().min(1),
|
|
3907
|
+
id: z21.number().int().positive()
|
|
3796
3908
|
}).strict()
|
|
3797
3909
|
}).strict();
|
|
3798
|
-
var pullRequestOutcomeSchema =
|
|
3799
|
-
action:
|
|
3800
|
-
pull_request:
|
|
3801
|
-
body:
|
|
3802
|
-
closed_at:
|
|
3803
|
-
created_at:
|
|
3804
|
-
id:
|
|
3805
|
-
merged:
|
|
3806
|
-
merged_at:
|
|
3807
|
-
number:
|
|
3808
|
-
title:
|
|
3809
|
-
updated_at:
|
|
3810
|
-
user:
|
|
3910
|
+
var pullRequestOutcomeSchema = z21.object({
|
|
3911
|
+
action: z21.enum(["opened", "closed", "reopened"]),
|
|
3912
|
+
pull_request: z21.object({
|
|
3913
|
+
body: z21.string().nullable().optional(),
|
|
3914
|
+
closed_at: z21.string().nullable().optional(),
|
|
3915
|
+
created_at: z21.string(),
|
|
3916
|
+
id: z21.number().int().positive(),
|
|
3917
|
+
merged: z21.boolean(),
|
|
3918
|
+
merged_at: z21.string().nullable().optional(),
|
|
3919
|
+
number: z21.number().int().positive(),
|
|
3920
|
+
title: z21.string().min(1).optional(),
|
|
3921
|
+
updated_at: z21.string(),
|
|
3922
|
+
user: z21.object({ login: z21.string().min(1) }).passthrough()
|
|
3811
3923
|
}).passthrough(),
|
|
3812
|
-
repository:
|
|
3813
|
-
full_name:
|
|
3814
|
-
id:
|
|
3924
|
+
repository: z21.object({
|
|
3925
|
+
full_name: z21.string().min(1),
|
|
3926
|
+
id: z21.number().int().positive()
|
|
3815
3927
|
}).passthrough()
|
|
3816
3928
|
}).passthrough().transform(
|
|
3817
3929
|
(provider) => canonicalPullRequestOutcomeSchema.parse({
|
|
@@ -3834,24 +3946,24 @@ var pullRequestOutcomeSchema = z19.object({
|
|
|
3834
3946
|
}
|
|
3835
3947
|
})
|
|
3836
3948
|
);
|
|
3837
|
-
var pullRequestLifecycleActionSchema =
|
|
3838
|
-
var canonicalPullRequestConversationSchema =
|
|
3839
|
-
pull_request:
|
|
3840
|
-
body:
|
|
3841
|
-
id:
|
|
3842
|
-
user:
|
|
3949
|
+
var pullRequestLifecycleActionSchema = z21.object({ action: z21.string() }).passthrough();
|
|
3950
|
+
var canonicalPullRequestConversationSchema = z21.object({
|
|
3951
|
+
pull_request: z21.object({
|
|
3952
|
+
body: z21.string().nullable().optional(),
|
|
3953
|
+
id: z21.number().int().positive(),
|
|
3954
|
+
user: z21.object({ login: z21.string().min(1) }).strict()
|
|
3843
3955
|
}).strict(),
|
|
3844
|
-
repository:
|
|
3845
|
-
sender:
|
|
3956
|
+
repository: z21.object({ full_name: z21.string().min(1) }).strict(),
|
|
3957
|
+
sender: z21.object({ login: z21.string().min(1) }).strict()
|
|
3846
3958
|
}).strict();
|
|
3847
|
-
var pullRequestConversationSchema =
|
|
3848
|
-
pull_request:
|
|
3849
|
-
body:
|
|
3850
|
-
id:
|
|
3851
|
-
user:
|
|
3959
|
+
var pullRequestConversationSchema = z21.object({
|
|
3960
|
+
pull_request: z21.object({
|
|
3961
|
+
body: z21.string().nullable().optional(),
|
|
3962
|
+
id: z21.number().int().positive(),
|
|
3963
|
+
user: z21.object({ login: z21.string().min(1) }).passthrough()
|
|
3852
3964
|
}).passthrough(),
|
|
3853
|
-
repository:
|
|
3854
|
-
sender:
|
|
3965
|
+
repository: z21.object({ full_name: z21.string().min(1) }).passthrough(),
|
|
3966
|
+
sender: z21.object({ login: z21.string().min(1) }).passthrough()
|
|
3855
3967
|
}).passthrough().transform(
|
|
3856
3968
|
(provider) => canonicalPullRequestConversationSchema.parse({
|
|
3857
3969
|
pull_request: {
|
|
@@ -3938,20 +4050,20 @@ function normalizeGitHubPullRequestLinkedIssues(args) {
|
|
|
3938
4050
|
}
|
|
3939
4051
|
|
|
3940
4052
|
// src/webhooks/merge-conflict.ts
|
|
3941
|
-
import { z as
|
|
4053
|
+
import { z as z22 } from "zod";
|
|
3942
4054
|
var EVENT_TYPE = "pull_request.merge_conflict";
|
|
3943
4055
|
var CLOSED_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
3944
4056
|
"pull_request.closed_unmerged",
|
|
3945
4057
|
"pull_request.merged"
|
|
3946
4058
|
]);
|
|
3947
|
-
var pullRequestSchema3 =
|
|
3948
|
-
base:
|
|
3949
|
-
number:
|
|
3950
|
-
head:
|
|
3951
|
-
html_url:
|
|
3952
|
-
mergeable:
|
|
3953
|
-
mergeable_state:
|
|
3954
|
-
state:
|
|
4059
|
+
var pullRequestSchema3 = z22.object({
|
|
4060
|
+
base: z22.object({ ref: z22.string().min(1) }),
|
|
4061
|
+
number: z22.number().int().positive().optional(),
|
|
4062
|
+
head: z22.object({ sha: z22.string().min(1) }),
|
|
4063
|
+
html_url: z22.string().min(1).optional(),
|
|
4064
|
+
mergeable: z22.boolean().nullable().optional(),
|
|
4065
|
+
mergeable_state: z22.string().optional(),
|
|
4066
|
+
state: z22.string()
|
|
3955
4067
|
});
|
|
3956
4068
|
function gitHubMergeConflictEvents(input) {
|
|
3957
4069
|
const { conflict } = input;
|
|
@@ -3991,7 +4103,7 @@ async function hasMatch(hasMatchEvent, ref) {
|
|
|
3991
4103
|
return false;
|
|
3992
4104
|
}
|
|
3993
4105
|
function deliveredPullRequest(payload, ref) {
|
|
3994
|
-
const parsed =
|
|
4106
|
+
const parsed = z22.object({ pull_request: pullRequestSchema3 }).safeParse(payload);
|
|
3995
4107
|
const pullRequest = parsed.success ? parsed.data.pull_request : void 0;
|
|
3996
4108
|
return pullRequest?.number === ref.number && typeof pullRequest.mergeable === "boolean" ? pullRequest : void 0;
|
|
3997
4109
|
}
|
|
@@ -4029,10 +4141,10 @@ async function loadGitHubMergeConflictEvents(args) {
|
|
|
4029
4141
|
}
|
|
4030
4142
|
|
|
4031
4143
|
// src/webhooks/pull-request-ready.ts
|
|
4032
|
-
import { z as
|
|
4144
|
+
import { z as z24 } from "zod";
|
|
4033
4145
|
|
|
4034
4146
|
// src/webhooks/installation-requests.ts
|
|
4035
|
-
import { z as
|
|
4147
|
+
import { z as z23 } from "zod";
|
|
4036
4148
|
function splitRepository(fullName, label) {
|
|
4037
4149
|
const [owner, name, ...extra] = fullName.split("/");
|
|
4038
4150
|
if (!owner || !name || extra.length > 0) {
|
|
@@ -4093,9 +4205,9 @@ async function markPullRequestFeedbackReviewing(env, target) {
|
|
|
4093
4205
|
}
|
|
4094
4206
|
);
|
|
4095
4207
|
}
|
|
4096
|
-
var repositoryPermissionSchema =
|
|
4097
|
-
permission:
|
|
4098
|
-
role_name:
|
|
4208
|
+
var repositoryPermissionSchema = z23.object({
|
|
4209
|
+
permission: z23.string().min(1),
|
|
4210
|
+
role_name: z23.string().optional()
|
|
4099
4211
|
});
|
|
4100
4212
|
var REPOSITORY_ROLE_TTL_MS = 10 * 60 * 1e3;
|
|
4101
4213
|
async function loadRepositoryRole(env, cache, target) {
|
|
@@ -4125,18 +4237,18 @@ async function loadRepositoryRole(env, cache, target) {
|
|
|
4125
4237
|
}
|
|
4126
4238
|
);
|
|
4127
4239
|
}
|
|
4128
|
-
var pullRequestSchema4 =
|
|
4129
|
-
draft:
|
|
4130
|
-
html_url:
|
|
4131
|
-
mergeable_state:
|
|
4132
|
-
merged:
|
|
4133
|
-
state:
|
|
4134
|
-
title:
|
|
4240
|
+
var pullRequestSchema4 = z23.object({
|
|
4241
|
+
draft: z23.boolean().optional(),
|
|
4242
|
+
html_url: z23.string().url(),
|
|
4243
|
+
mergeable_state: z23.string().nullable().optional(),
|
|
4244
|
+
merged: z23.boolean(),
|
|
4245
|
+
state: z23.enum(["open", "closed"]),
|
|
4246
|
+
title: z23.string()
|
|
4135
4247
|
});
|
|
4136
|
-
var reviewsSchema =
|
|
4137
|
-
|
|
4138
|
-
state:
|
|
4139
|
-
user:
|
|
4248
|
+
var reviewsSchema = z23.array(
|
|
4249
|
+
z23.object({
|
|
4250
|
+
state: z23.string(),
|
|
4251
|
+
user: z23.object({ login: z23.string() }).nullable()
|
|
4140
4252
|
})
|
|
4141
4253
|
);
|
|
4142
4254
|
async function loadPullRequestMergeState(env, pullRequest) {
|
|
@@ -4201,10 +4313,10 @@ var READY_ACTIONS = {
|
|
|
4201
4313
|
]),
|
|
4202
4314
|
pull_request_review: /* @__PURE__ */ new Set(["dismissed", "submitted"])
|
|
4203
4315
|
};
|
|
4204
|
-
var pullRequestWebhookSchema =
|
|
4205
|
-
action:
|
|
4206
|
-
pull_request:
|
|
4207
|
-
repository:
|
|
4316
|
+
var pullRequestWebhookSchema = z24.object({
|
|
4317
|
+
action: z24.string(),
|
|
4318
|
+
pull_request: z24.object({ number: z24.number().int().positive() }),
|
|
4319
|
+
repository: z24.object({ full_name: z24.string().min(1) })
|
|
4208
4320
|
});
|
|
4209
4321
|
function pullRequestReadyTargets(eventName, body) {
|
|
4210
4322
|
if (eventName === "check_suite") return checkSuitePullRequests(body);
|
|
@@ -4299,7 +4411,7 @@ async function syncGitHubPullRequestReadyNotices(args) {
|
|
|
4299
4411
|
}
|
|
4300
4412
|
|
|
4301
4413
|
// src/webhooks/pull-request-match-data.ts
|
|
4302
|
-
import { z as
|
|
4414
|
+
import { z as z25 } from "zod";
|
|
4303
4415
|
var LOOKUPS_BY_MATCH_KEY = {
|
|
4304
4416
|
authors: ["authors"],
|
|
4305
4417
|
openerEmail: ["opener"],
|
|
@@ -4307,16 +4419,16 @@ var LOOKUPS_BY_MATCH_KEY = {
|
|
|
4307
4419
|
openerUsername: ["opener"]
|
|
4308
4420
|
};
|
|
4309
4421
|
var ALL_LOOKUPS = ["authors", "opener", "openerRole"];
|
|
4310
|
-
var lookupDataSchema =
|
|
4311
|
-
authors:
|
|
4312
|
-
openerRole:
|
|
4313
|
-
openerUsername:
|
|
4422
|
+
var lookupDataSchema = z25.object({
|
|
4423
|
+
authors: z25.array(z25.string().min(1)).min(1).optional(),
|
|
4424
|
+
openerRole: z25.string().min(1).optional(),
|
|
4425
|
+
openerUsername: z25.string().min(1).optional()
|
|
4314
4426
|
}).strict();
|
|
4315
4427
|
function lookupData(input) {
|
|
4316
4428
|
return lookupDataSchema.parse(definedValues(input));
|
|
4317
4429
|
}
|
|
4318
|
-
var webhookSchema =
|
|
4319
|
-
repository:
|
|
4430
|
+
var webhookSchema = z25.object({
|
|
4431
|
+
repository: z25.object({ full_name: z25.string().min(1) })
|
|
4320
4432
|
});
|
|
4321
4433
|
function pullRequestNumbers(events) {
|
|
4322
4434
|
const numbers = /* @__PURE__ */ new Map();
|
|
@@ -4459,7 +4571,7 @@ async function withGitHubPullRequestMatchData(args) {
|
|
|
4459
4571
|
}
|
|
4460
4572
|
|
|
4461
4573
|
// src/webhooks/pull-request-people.ts
|
|
4462
|
-
import { z as
|
|
4574
|
+
import { z as z26 } from "zod";
|
|
4463
4575
|
var PEOPLE_EVENTS = /* @__PURE__ */ new Set([
|
|
4464
4576
|
"pull_request.review.approved",
|
|
4465
4577
|
"pull_request.merged"
|
|
@@ -4469,18 +4581,18 @@ var PAGE_SIZE = 100;
|
|
|
4469
4581
|
var MAX_PAGES = 3;
|
|
4470
4582
|
var CO_AUTHOR_TRAILER = /^co-authored-by:[^<\n]*<([^>\s]+@[^>\s]+)>\s*$/gim;
|
|
4471
4583
|
var GITHUB_NOREPLY_EMAIL = /^(?:\d+\+)?(?<login>[^@+]+)@users\.noreply\.github\.com$/i;
|
|
4472
|
-
var webhookSchema2 =
|
|
4473
|
-
pull_request:
|
|
4474
|
-
assignees:
|
|
4475
|
-
number:
|
|
4476
|
-
user:
|
|
4584
|
+
var webhookSchema2 = z26.object({
|
|
4585
|
+
pull_request: z26.object({
|
|
4586
|
+
assignees: z26.array(z26.object({ login: z26.string().min(1) })).nullish(),
|
|
4587
|
+
number: z26.number(),
|
|
4588
|
+
user: z26.object({ login: z26.string().min(1) }).nullish()
|
|
4477
4589
|
}),
|
|
4478
|
-
repository:
|
|
4590
|
+
repository: z26.object({ full_name: z26.string().min(1) })
|
|
4479
4591
|
});
|
|
4480
|
-
var commitPageSchema =
|
|
4481
|
-
|
|
4482
|
-
author:
|
|
4483
|
-
commit:
|
|
4592
|
+
var commitPageSchema = z26.array(
|
|
4593
|
+
z26.object({
|
|
4594
|
+
author: z26.object({ login: z26.string().min(1) }).nullish(),
|
|
4595
|
+
commit: z26.object({ message: z26.string() })
|
|
4484
4596
|
})
|
|
4485
4597
|
);
|
|
4486
4598
|
function shareCommitPages(load) {
|
|
@@ -4625,10 +4737,10 @@ function webhookInstallationId(body) {
|
|
|
4625
4737
|
}
|
|
4626
4738
|
return parseInstallationId(installation.id);
|
|
4627
4739
|
}
|
|
4628
|
-
var feedbackTargetSchema =
|
|
4629
|
-
commentId:
|
|
4630
|
-
commentKind:
|
|
4631
|
-
repo:
|
|
4740
|
+
var feedbackTargetSchema = z27.object({
|
|
4741
|
+
commentId: z27.number(),
|
|
4742
|
+
commentKind: z27.enum(["conversation", "review"]),
|
|
4743
|
+
repo: z27.string().min(1)
|
|
4632
4744
|
});
|
|
4633
4745
|
function pullRequestFeedbackTarget(events) {
|
|
4634
4746
|
const event = events.find(
|
|
@@ -4781,6 +4893,7 @@ function createGitHubWebhookRoute(args) {
|
|
|
4781
4893
|
appIdEnv: args.appIdEnv,
|
|
4782
4894
|
body,
|
|
4783
4895
|
installationIdEnv: args.installationIdEnv,
|
|
4896
|
+
...args.loadGitHubIncidents ? { loadGitHubIncidents: args.loadGitHubIncidents } : void 0,
|
|
4784
4897
|
loadPullRequestFacts: needsCheckSuitePullRequestFacts(checkSuiteMatchKeys),
|
|
4785
4898
|
log: args.log,
|
|
4786
4899
|
privateKeyEnv: args.privateKeyEnv
|
|
@@ -4910,18 +5023,18 @@ function gitHubResourceUrl(input) {
|
|
|
4910
5023
|
}
|
|
4911
5024
|
|
|
4912
5025
|
// src/pull-request-outcomes/commit-composition.ts
|
|
4913
|
-
import { z as
|
|
4914
|
-
var canonicalCommitSchema =
|
|
4915
|
-
authorEmail:
|
|
4916
|
-
authorLogin:
|
|
5026
|
+
import { z as z28 } from "zod";
|
|
5027
|
+
var canonicalCommitSchema = z28.object({
|
|
5028
|
+
authorEmail: z28.string().nullable(),
|
|
5029
|
+
authorLogin: z28.string().nullable()
|
|
4917
5030
|
}).strict();
|
|
4918
|
-
var providerCommitSchema =
|
|
4919
|
-
author:
|
|
4920
|
-
commit:
|
|
4921
|
-
author:
|
|
5031
|
+
var providerCommitSchema = z28.object({
|
|
5032
|
+
author: z28.object({ login: z28.string() }).passthrough().nullable(),
|
|
5033
|
+
commit: z28.object({
|
|
5034
|
+
author: z28.object({ email: z28.string() }).passthrough().nullable()
|
|
4922
5035
|
}).passthrough()
|
|
4923
5036
|
}).passthrough();
|
|
4924
|
-
var commitPageSchema2 =
|
|
5037
|
+
var commitPageSchema2 = z28.array(providerCommitSchema).transform(
|
|
4925
5038
|
(commits) => commits.map(
|
|
4926
5039
|
(commit) => canonicalCommitSchema.parse({
|
|
4927
5040
|
authorEmail: commit.commit.author?.email ?? null,
|
|
@@ -6229,6 +6342,7 @@ async function githubGrantForEgress(ctx) {
|
|
|
6229
6342
|
}
|
|
6230
6343
|
|
|
6231
6344
|
// src/plugin.ts
|
|
6345
|
+
var CHECK_SUITE_INCIDENT_WINDOW_MS = 60 * 60 * 1e3;
|
|
6232
6346
|
function githubPlugin(options = {}) {
|
|
6233
6347
|
const botNameEnv = options.botNameEnv ?? "GITHUB_APP_BOT_NAME";
|
|
6234
6348
|
const botEmailEnv = options.botEmailEnv ?? "GITHUB_APP_BOT_EMAIL";
|
|
@@ -6433,6 +6547,10 @@ function githubPlugin(options = {}) {
|
|
|
6433
6547
|
codeChanges: ctx.codeChanges,
|
|
6434
6548
|
db: ctx.db,
|
|
6435
6549
|
installationId: () => readEnv(installationIdEnv),
|
|
6550
|
+
loadGitHubIncidents: async () => await loadGitHubStatusIncidents(
|
|
6551
|
+
ctx.cache,
|
|
6552
|
+
CHECK_SUITE_INCIDENT_WINDOW_MS
|
|
6553
|
+
),
|
|
6436
6554
|
installationIdEnv,
|
|
6437
6555
|
loadRepositoryRole: async (target) => await loadRepositoryRole(installationEnv, ctx.cache, target),
|
|
6438
6556
|
loadGitHubLogin: async (identityId) => linkedGitHubLogin(
|