@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
|
@@ -1237,7 +1237,9 @@ function buildCheckSuiteEvent(args) {
|
|
|
1237
1237
|
const failingChecks = (args.failingChecks ?? []).slice(0, 12);
|
|
1238
1238
|
const failingCount = failingChecks.length;
|
|
1239
1239
|
const branchSuffix = args.headBranch ? ` on ${args.headBranch}` : "";
|
|
1240
|
-
const
|
|
1240
|
+
const incidents = args.eventType === "pull_request.checks.failed" ? args.githubIncidents ?? [] : [];
|
|
1241
|
+
const incidentSuffix = incidents.length > 0 ? ` githubstatus.com lists ${incidents.length} open or recent GitHub incident${incidents.length === 1 ? "" : "s"}.` : "";
|
|
1242
|
+
const trustedSummary = args.eventType === "pull_request.checks.failed" ? `${resource.label} checks failed${failingCount > 0 ? ` (${failingCount})` : ""}${shortSha ? ` for ${shortSha}` : ""}${branchSuffix}.${incidentSuffix}` : `${resource.label} check suite recovered${shortSha ? ` for ${shortSha}` : ""}${branchSuffix}.`;
|
|
1241
1243
|
const data = checkSuiteEventDataSchema.parse(
|
|
1242
1244
|
definedValues({
|
|
1243
1245
|
repo: args.repo,
|
|
@@ -1269,9 +1271,22 @@ function buildCheckSuiteEvent(args) {
|
|
|
1269
1271
|
if (!name) return void 0;
|
|
1270
1272
|
return check.htmlUrl ? `${name}: ${check.htmlUrl}` : name;
|
|
1271
1273
|
}).filter((part) => part !== void 0) : [];
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
|
|
1274
|
+
const untrustedSections = [
|
|
1275
|
+
...untrustedParts.length > 0 ? [
|
|
1276
|
+
[`Failed checks:`, ...untrustedParts.map((part) => `- ${part}`)].join(
|
|
1277
|
+
"\n"
|
|
1278
|
+
)
|
|
1279
|
+
] : [],
|
|
1280
|
+
...incidents.length > 0 ? [
|
|
1281
|
+
[
|
|
1282
|
+
"GitHub status incidents:",
|
|
1283
|
+
...incidents.map(
|
|
1284
|
+
(incident) => `- ${oneLineLabel(incident.name, 160)} (${incident.status}; ${incident.components.join(", ") || "no components"}; started ${incident.startedAt}${incident.resolvedAt ? `, resolved ${incident.resolvedAt}` : ""}): ${incident.url}`
|
|
1285
|
+
)
|
|
1286
|
+
].join("\n")
|
|
1287
|
+
] : []
|
|
1288
|
+
];
|
|
1289
|
+
const untrustedText = untrustedSections.length > 0 ? untrustedSections.join("\n\n") : void 0;
|
|
1275
1290
|
return {
|
|
1276
1291
|
eventKey: gitHubEventKey(
|
|
1277
1292
|
args.deliveryId,
|
|
@@ -1329,6 +1344,7 @@ function normalizeCheckSuiteEvents(deliveryId, body, options) {
|
|
|
1329
1344
|
deliveryId,
|
|
1330
1345
|
eventType,
|
|
1331
1346
|
failingChecks: eventType === "pull_request.checks.failed" ? options?.failingChecks : void 0,
|
|
1347
|
+
githubIncidents: eventType === "pull_request.checks.failed" ? options?.githubIncidents : void 0,
|
|
1332
1348
|
headSha,
|
|
1333
1349
|
latestCheckRunsCount: typeof suite.latest_check_runs_count === "number" ? suite.latest_check_runs_count : void 0,
|
|
1334
1350
|
repo,
|
|
@@ -1490,6 +1506,16 @@ async function loadCheckSuiteFacts(args) {
|
|
|
1490
1506
|
});
|
|
1491
1507
|
}
|
|
1492
1508
|
}
|
|
1509
|
+
if (target.loadFailingChecks && args.loadGitHubIncidents) {
|
|
1510
|
+
try {
|
|
1511
|
+
const incidents = await args.loadGitHubIncidents();
|
|
1512
|
+
if (incidents.length > 0) facts.githubIncidents = incidents;
|
|
1513
|
+
} catch (error) {
|
|
1514
|
+
args.log?.error("GitHub status load failed", {
|
|
1515
|
+
errorType: error instanceof Error ? error.name : "UnknownError"
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1493
1519
|
if (target.loadPullRequestFacts) {
|
|
1494
1520
|
try {
|
|
1495
1521
|
const token = await issueInstallationToken({
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PluginCache } from "@sentry/junior-plugin-api";
|
|
2
|
+
/** One incident from githubstatus.com. */
|
|
3
|
+
export type GitHubStatusIncident = {
|
|
4
|
+
components: string[];
|
|
5
|
+
impact: string;
|
|
6
|
+
name: string;
|
|
7
|
+
resolvedAt?: string;
|
|
8
|
+
startedAt: string;
|
|
9
|
+
status: string;
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Read GitHub incidents that are open, or that were resolved within
|
|
14
|
+
* `withinMs`. Callers share one cached read of githubstatus.com.
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadGitHubStatusIncidents(cache: PluginCache, withinMs: number): Promise<GitHubStatusIncident[]>;
|