@sentry/junior-github 0.301.0 → 0.302.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-YUF5P5I7.js → chunk-6SOJ5TN6.js} +142 -31
- package/dist/clone-command.d.ts +2 -0
- package/dist/db/schema.d.ts +23 -14
- package/dist/draft-readiness.d.ts +31 -0
- package/dist/events/pull-request.d.ts +1 -1
- package/dist/events/repository.d.ts +1 -1
- package/dist/graphql-documents.d.ts +13 -0
- package/dist/hooks-path-command.d.ts +5 -0
- package/dist/index.js +2060 -1699
- package/dist/merge-conflict-checks/heartbeat.d.ts +9 -5
- package/dist/merge-conflict-checks/policy.d.ts +74 -0
- package/dist/pull-request-outcomes/reconcile.d.ts +2 -1
- package/dist/pull-request-outcomes/store.d.ts +15 -10
- package/dist/testing.js +1 -1
- package/dist/tool-support/github-text.d.ts +2 -2
- package/dist/tools/clone-repository.d.ts +89 -7
- package/dist/tools/comment-on-issue.d.ts +87 -3
- package/dist/tools/comment-on-pull-request.d.ts +87 -3
- package/dist/tools/create-issue.d.ts +86 -4
- package/dist/tools/create-pull-request.d.ts +88 -6
- package/dist/tools/get-deployment.d.ts +90 -8
- package/dist/tools/get-issue.d.ts +98 -16
- package/dist/tools/get-pull-request.d.ts +112 -9
- package/dist/tools/get-release.d.ts +90 -8
- package/dist/tools/get-repository.d.ts +90 -8
- package/dist/tools/get-status.d.ts +87 -5
- package/dist/tools/react-to-issue.d.ts +87 -3
- package/dist/tools/resolve-pull-request-review-thread.d.ts +87 -5
- package/dist/tools/submit-pull-request-review.d.ts +87 -3
- package/dist/tools/update-issue-comment.d.ts +87 -3
- package/dist/tools/update-issue.d.ts +106 -24
- package/dist/tools/update-pull-request-feedback.d.ts +87 -5
- package/dist/tools/update-pull-request.d.ts +109 -26
- package/dist/tools.d.ts +3 -3
- package/dist/webhooks/check-suite.d.ts +30 -3
- package/dist/webhooks/handler.d.ts +2 -0
- package/dist/webhooks/installation-requests.d.ts +8 -1
- package/dist/webhooks/merge-conflict.d.ts +7 -2
- package/dist/webhooks/pull-request-action.d.ts +37 -0
- package/migrations/0012_pull_request_next_action.sql +5 -0
- package/migrations/meta/0012_snapshot.json +434 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +3 -2
- package/skills/github-code/SKILL.md +1 -1
- package/skills/github-code/SPEC.md +2 -2
- package/skills/github-code/references/workflow.md +1 -1
- package/dist/webhooks/pull-request-ready.d.ts +0 -31
- package/dist/webhooks/pull-request-review-request.d.ts +0 -32
|
@@ -217,6 +217,7 @@ import {
|
|
|
217
217
|
} from "@sentry/junior-plugin-api";
|
|
218
218
|
var GITHUB_PULL_REQUEST_EVENTS = [
|
|
219
219
|
"pull_request.checks.failed",
|
|
220
|
+
"pull_request.checks.passed",
|
|
220
221
|
"pull_request.checks.recovered",
|
|
221
222
|
"pull_request.comment.created",
|
|
222
223
|
"pull_request.opened",
|
|
@@ -273,7 +274,7 @@ var GITHUB_PULL_REQUEST_OUTCOME_GUIDANCE = {
|
|
|
273
274
|
"pull_request.review.approved": `Mention each person in People involved, or the person who asked for the pull request if that line is missing. Say who approved it and link it. Do not merge it unless asked. ${MERGE_STATE_CHECK}`,
|
|
274
275
|
"pull_request.merged": "Mention each person in People involved, or the person who asked for the pull request if that line is missing. Say that it merged and link it."
|
|
275
276
|
};
|
|
276
|
-
var DRAFT_CHECKS_RECOVERED_GUIDANCE = "If the pull request is still a draft, call github_getPullRequest and read its `checks`. When `checks.required` is `passing` and no decision is open, in the pull request body or in an open review item that waits on the person who asked for it
|
|
277
|
+
var DRAFT_CHECKS_RECOVERED_GUIDANCE = "If the pull request is still a draft, call github_getPullRequest and read its `checks`, `code_owners`, and `agents_md`. When `checks.required` is `passing` and no decision is open, in the pull request body or in an open review item that waits on the person who asked for it: mark it ready with github_updatePullRequest and draft false, and report that in the originating thread, when the person who asked for it said to mark it ready, or when `code_owners` is empty and `agents_md` does not ask for draft pull requests or say that a person marks them ready. Otherwise keep it a draft: marking it ready would ask the code owners to review, or break the AGENTS.md rule. Tell the person who asked for it in the originating thread that the checks pass and the draft waits for their review, and name why: the code owners that marking it ready asks, or the AGENTS.md rule. If you already told them for this head commit, stay silent. When it is `failing`, fix the failing checks like a failed check. When it is `pending` or `not_reported`, stay silent: a later passing suite wakes you again. `not_reported` means the required checks may not have started on the latest commit yet, not that none are required.";
|
|
277
278
|
function gitHubPullRequestCreateWatch(config, pullRequest) {
|
|
278
279
|
const outcomeEvents = Object.keys(
|
|
279
280
|
GITHUB_PULL_REQUEST_OUTCOME_GUIDANCE
|
|
@@ -319,6 +320,7 @@ var GITHUB_PULL_REQUEST_COMMENT_EVENTS = [
|
|
|
319
320
|
];
|
|
320
321
|
var GITHUB_PULL_REQUEST_CHECK_EVENTS = [
|
|
321
322
|
"pull_request.checks.failed",
|
|
323
|
+
"pull_request.checks.passed",
|
|
322
324
|
"pull_request.checks.recovered"
|
|
323
325
|
];
|
|
324
326
|
var GITHUB_PULL_REQUEST_MATCH_FIELDS = eventMatchFieldsSchema5.parse({
|
|
@@ -1233,6 +1235,10 @@ var CHECK_SUITE_PULL_REQUEST_MATCH_KEYS = /* @__PURE__ */ new Set([
|
|
|
1233
1235
|
"openerRole",
|
|
1234
1236
|
"openerUsername"
|
|
1235
1237
|
]);
|
|
1238
|
+
var LATE_MATCH_KEYS = /* @__PURE__ */ new Set([
|
|
1239
|
+
...CHECK_SUITE_PULL_REQUEST_MATCH_KEYS,
|
|
1240
|
+
"authors"
|
|
1241
|
+
]);
|
|
1236
1242
|
var checkRunRepoRefSchema = z4.object({
|
|
1237
1243
|
id: z4.number(),
|
|
1238
1244
|
name: z4.string().min(1),
|
|
@@ -1273,12 +1279,27 @@ var checkSuiteWebhookSchema = z4.object({
|
|
|
1273
1279
|
}),
|
|
1274
1280
|
repository: repositorySchema
|
|
1275
1281
|
});
|
|
1282
|
+
var checkSuitesListResponseSchema = z4.object({
|
|
1283
|
+
check_suites: z4.array(
|
|
1284
|
+
z4.object({
|
|
1285
|
+
app: z4.object({ slug: z4.string().nullable().optional() }).nullable().optional(),
|
|
1286
|
+
conclusion: z4.string().nullable().optional(),
|
|
1287
|
+
id: z4.number(),
|
|
1288
|
+
latest_check_runs_count: z4.number().nullable().optional(),
|
|
1289
|
+
status: z4.string().nullable().optional()
|
|
1290
|
+
})
|
|
1291
|
+
),
|
|
1292
|
+
total_count: z4.number()
|
|
1293
|
+
});
|
|
1276
1294
|
var checkRunsListResponseSchema = z4.object({
|
|
1277
1295
|
check_runs: z4.array(z4.unknown()).optional()
|
|
1278
1296
|
}).passthrough();
|
|
1279
1297
|
function isCheckSuiteRepositoryPullRequest(pullRequest, repositoryId) {
|
|
1280
1298
|
return pullRequest.base.repo.id === repositoryId;
|
|
1281
1299
|
}
|
|
1300
|
+
var CHECKS_PASSED = "pull_request.checks.passed";
|
|
1301
|
+
var PASSING_SUITE_CONCLUSIONS = /* @__PURE__ */ new Set(["neutral", "skipped", "success"]);
|
|
1302
|
+
var MAX_CHECK_SUITE_PAGES = 10;
|
|
1282
1303
|
function checkSuiteEventType(conclusion) {
|
|
1283
1304
|
if (conclusion === "failure" || conclusion === "timed_out") {
|
|
1284
1305
|
return "pull_request.checks.failed";
|
|
@@ -1288,6 +1309,14 @@ function checkSuiteEventType(conclusion) {
|
|
|
1288
1309
|
}
|
|
1289
1310
|
return void 0;
|
|
1290
1311
|
}
|
|
1312
|
+
function checkSuiteEventTypes(conclusion) {
|
|
1313
|
+
const eventType = checkSuiteEventType(conclusion);
|
|
1314
|
+
const eventTypes = eventType ? [eventType] : [];
|
|
1315
|
+
if (PASSING_SUITE_CONCLUSIONS.has(conclusion ?? "")) {
|
|
1316
|
+
eventTypes.push(CHECKS_PASSED);
|
|
1317
|
+
}
|
|
1318
|
+
return eventTypes;
|
|
1319
|
+
}
|
|
1291
1320
|
function isGitHubNotFoundError(error) {
|
|
1292
1321
|
return error instanceof Error && error.name === "GitHubRequestError" && "status" in error && error.status === 404;
|
|
1293
1322
|
}
|
|
@@ -1343,7 +1372,8 @@ function buildCheckSuiteEvent(args) {
|
|
|
1343
1372
|
const branchSuffix = args.headBranch ? ` on ${args.headBranch}` : "";
|
|
1344
1373
|
const incidents = args.eventType === "pull_request.checks.failed" ? args.githubIncidents ?? [] : [];
|
|
1345
1374
|
const incidentSuffix = incidents.length > 0 ? ` githubstatus.com lists ${incidents.length} open or recent GitHub incident${incidents.length === 1 ? "" : "s"}.` : "";
|
|
1346
|
-
const
|
|
1375
|
+
const shaSuffix = shortSha ? ` for ${shortSha}` : "";
|
|
1376
|
+
const trustedSummary = args.eventType === "pull_request.checks.failed" ? `${resource.label} checks failed${failingCount > 0 ? ` (${failingCount})` : ""}${shaSuffix}${branchSuffix}.${incidentSuffix}` : args.eventType === CHECKS_PASSED ? `${resource.label} all check suites passed${shaSuffix}${branchSuffix}.` : `${resource.label} check suite recovered${shaSuffix}${branchSuffix}.`;
|
|
1347
1377
|
const data = checkSuiteEventDataSchema.parse(
|
|
1348
1378
|
definedValues({
|
|
1349
1379
|
repo: args.repo,
|
|
@@ -1392,7 +1422,10 @@ function buildCheckSuiteEvent(args) {
|
|
|
1392
1422
|
];
|
|
1393
1423
|
const untrustedText = untrustedSections.length > 0 ? untrustedSections.join("\n\n") : void 0;
|
|
1394
1424
|
return {
|
|
1395
|
-
|
|
1425
|
+
// Each suite that finishes last can see every suite green, so name the
|
|
1426
|
+
// head commit, not the delivery. Core then delivers checks.passed once
|
|
1427
|
+
// per head commit to each Watch and event automation.
|
|
1428
|
+
eventKey: args.eventType === CHECKS_PASSED && args.headSha ? `github:${CHECKS_PASSED}:${resource.identifier}:${args.headSha.toLowerCase()}` : gitHubEventKey(
|
|
1396
1429
|
args.deliveryId,
|
|
1397
1430
|
pullRequestNumber === void 0 ? args.eventType : `${args.eventType}:${pullRequestNumber}`
|
|
1398
1431
|
),
|
|
@@ -1435,7 +1468,10 @@ function normalizeCheckSuiteEvents(deliveryId, body, options) {
|
|
|
1435
1468
|
if (!parsed.success || parsed.data.action !== "completed") return [];
|
|
1436
1469
|
const conclusion = parsed.data.check_suite.conclusion;
|
|
1437
1470
|
const eventType = checkSuiteEventType(conclusion);
|
|
1438
|
-
|
|
1471
|
+
const eventTypes = checkSuiteEventTypes(conclusion).filter(
|
|
1472
|
+
(type) => type !== CHECKS_PASSED || options?.allCheckSuitesPassed
|
|
1473
|
+
);
|
|
1474
|
+
if (eventTypes.length === 0 || typeof conclusion !== "string") return [];
|
|
1439
1475
|
const suite = parsed.data.check_suite;
|
|
1440
1476
|
const appName = suite.app?.name?.trim() || suite.app?.slug?.trim() || void 0;
|
|
1441
1477
|
const headBranch = checkSuiteHeadBranch(suite.head_branch);
|
|
@@ -1446,7 +1482,6 @@ function normalizeCheckSuiteEvents(deliveryId, body, options) {
|
|
|
1446
1482
|
appName,
|
|
1447
1483
|
checkSuiteId: suite.id,
|
|
1448
1484
|
deliveryId,
|
|
1449
|
-
eventType,
|
|
1450
1485
|
failingChecks: eventType === "pull_request.checks.failed" ? options?.failingChecks : void 0,
|
|
1451
1486
|
githubIncidents: eventType === "pull_request.checks.failed" ? options?.githubIncidents : void 0,
|
|
1452
1487
|
headSha,
|
|
@@ -1458,28 +1493,32 @@ function normalizeCheckSuiteEvents(deliveryId, body, options) {
|
|
|
1458
1493
|
(pullRequest) => isCheckSuiteRepositoryPullRequest(pullRequest, repository.id)
|
|
1459
1494
|
);
|
|
1460
1495
|
if (sameRepoPullRequests.length === 0) {
|
|
1461
|
-
return
|
|
1462
|
-
buildCheckSuiteEvent({
|
|
1496
|
+
return eventTypes.map(
|
|
1497
|
+
(type) => buildCheckSuiteEvent({
|
|
1463
1498
|
...shared,
|
|
1499
|
+
eventType: type,
|
|
1464
1500
|
...headBranch ? { headBranch } : void 0
|
|
1465
1501
|
})
|
|
1466
|
-
];
|
|
1467
|
-
}
|
|
1468
|
-
return sameRepoPullRequests.flatMap((pullRequest) => {
|
|
1469
|
-
const facts = options?.pullRequestFactsByNumber?.[pullRequest.number];
|
|
1470
|
-
const pullRequestHeadBranch = checkSuiteHeadBranch(pullRequest.head?.ref) ?? headBranch;
|
|
1471
|
-
return pullRequestTargets(
|
|
1472
|
-
buildCheckSuiteEvent({
|
|
1473
|
-
...shared,
|
|
1474
|
-
...facts?.openerEmail ? { openerEmail: facts.openerEmail } : void 0,
|
|
1475
|
-
...facts?.openerUsername ? { openerUsername: facts.openerUsername } : void 0,
|
|
1476
|
-
...pullRequestHeadBranch ? { headBranch: pullRequestHeadBranch } : void 0,
|
|
1477
|
-
...typeof facts?.isDraft === "boolean" ? { isDraft: facts.isDraft } : void 0,
|
|
1478
|
-
pullRequestNumber: pullRequest.number
|
|
1479
|
-
}),
|
|
1480
|
-
repo
|
|
1481
1502
|
);
|
|
1482
|
-
}
|
|
1503
|
+
}
|
|
1504
|
+
return eventTypes.flatMap(
|
|
1505
|
+
(type) => sameRepoPullRequests.flatMap((pullRequest) => {
|
|
1506
|
+
const facts = options?.pullRequestFactsByNumber?.[pullRequest.number];
|
|
1507
|
+
const pullRequestHeadBranch = checkSuiteHeadBranch(pullRequest.head?.ref) ?? headBranch;
|
|
1508
|
+
return pullRequestTargets(
|
|
1509
|
+
buildCheckSuiteEvent({
|
|
1510
|
+
...shared,
|
|
1511
|
+
eventType: type,
|
|
1512
|
+
...facts?.openerEmail ? { openerEmail: facts.openerEmail } : void 0,
|
|
1513
|
+
...facts?.openerUsername ? { openerUsername: facts.openerUsername } : void 0,
|
|
1514
|
+
...pullRequestHeadBranch ? { headBranch: pullRequestHeadBranch } : void 0,
|
|
1515
|
+
...typeof facts?.isDraft === "boolean" ? { isDraft: facts.isDraft } : void 0,
|
|
1516
|
+
pullRequestNumber: pullRequest.number
|
|
1517
|
+
}),
|
|
1518
|
+
repo
|
|
1519
|
+
);
|
|
1520
|
+
})
|
|
1521
|
+
);
|
|
1483
1522
|
}
|
|
1484
1523
|
function checkSuitePullRequests(body) {
|
|
1485
1524
|
const parsed = checkSuiteWebhookSchema.safeParse(body);
|
|
@@ -1495,8 +1534,8 @@ function checkSuitePullRequests(body) {
|
|
|
1495
1534
|
function parseCheckSuitePublishTargets(body) {
|
|
1496
1535
|
const parsed = checkSuiteWebhookSchema.safeParse(body);
|
|
1497
1536
|
if (!parsed.success || parsed.data.action !== "completed") return void 0;
|
|
1498
|
-
const
|
|
1499
|
-
if (
|
|
1537
|
+
const eventTypes = checkSuiteEventTypes(parsed.data.check_suite.conclusion);
|
|
1538
|
+
if (eventTypes.length === 0) return void 0;
|
|
1500
1539
|
const repository = parsed.data.repository;
|
|
1501
1540
|
const repo = repository.full_name;
|
|
1502
1541
|
const identifiers = /* @__PURE__ */ new Set([
|
|
@@ -1513,17 +1552,31 @@ function parseCheckSuitePublishTargets(body) {
|
|
|
1513
1552
|
// Every copy sets this repo, so a broad trigger for another repo adds
|
|
1514
1553
|
// no lazy keys.
|
|
1515
1554
|
data: { repo: gitHubRepoDataSchema.parse(repo) },
|
|
1516
|
-
eventTypes
|
|
1555
|
+
eventTypes,
|
|
1517
1556
|
identifiers: [...identifiers]
|
|
1518
1557
|
};
|
|
1519
1558
|
}
|
|
1559
|
+
async function wantsCheckSuitePassed(args) {
|
|
1560
|
+
const targets = parseCheckSuitePublishTargets(args.body);
|
|
1561
|
+
if (!args.hasMatch || !targets?.eventTypes.includes(CHECKS_PASSED)) {
|
|
1562
|
+
return false;
|
|
1563
|
+
}
|
|
1564
|
+
const keys = await args.neededMatchKeys?.({
|
|
1565
|
+
...targets,
|
|
1566
|
+
eventTypes: [CHECKS_PASSED]
|
|
1567
|
+
}) ?? [];
|
|
1568
|
+
if (keys.some((key) => LATE_MATCH_KEYS.has(key))) return true;
|
|
1569
|
+
return await args.hasMatch(
|
|
1570
|
+
normalizeCheckSuiteEvents(args.deliveryId, args.body, {
|
|
1571
|
+
allCheckSuitesPassed: true
|
|
1572
|
+
}).filter((event) => event.eventType === CHECKS_PASSED)
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1520
1575
|
function parseCheckSuiteFactsTarget(body, options) {
|
|
1521
1576
|
const parsed = checkSuiteWebhookSchema.safeParse(body);
|
|
1522
1577
|
if (!parsed.success || parsed.data.action !== "completed") return void 0;
|
|
1523
1578
|
const conclusion = parsed.data.check_suite.conclusion;
|
|
1524
|
-
if (conclusion
|
|
1525
|
-
return void 0;
|
|
1526
|
-
}
|
|
1579
|
+
if (checkSuiteEventTypes(conclusion).length === 0) return void 0;
|
|
1527
1580
|
const headSha = parsed.data.check_suite.head_sha;
|
|
1528
1581
|
const checkSuiteId = parsed.data.check_suite.id;
|
|
1529
1582
|
if (typeof headSha !== "string" || !/^[0-9a-f]{7,40}$/i.test(headSha) || typeof checkSuiteId !== "number") {
|
|
@@ -1541,12 +1594,16 @@ function parseCheckSuiteFactsTarget(body, options) {
|
|
|
1541
1594
|
const loadPullRequestFacts = Boolean(
|
|
1542
1595
|
options?.loadPullRequestFacts && pullRequestNumbers.length > 0
|
|
1543
1596
|
);
|
|
1544
|
-
|
|
1597
|
+
const loadCheckSuites = Boolean(
|
|
1598
|
+
options?.loadCheckSuites && PASSING_SUITE_CONCLUSIONS.has(conclusion ?? "")
|
|
1599
|
+
);
|
|
1600
|
+
if (!loadFailingChecks && !loadPullRequestFacts && !loadCheckSuites) {
|
|
1545
1601
|
return void 0;
|
|
1546
1602
|
}
|
|
1547
1603
|
return {
|
|
1548
1604
|
checkSuiteId,
|
|
1549
1605
|
headSha,
|
|
1606
|
+
loadCheckSuites,
|
|
1550
1607
|
loadFailingChecks,
|
|
1551
1608
|
loadPullRequestFacts,
|
|
1552
1609
|
owner: repository.owner.login,
|
|
@@ -1578,8 +1635,31 @@ function needsCheckSuitePullRequestFacts(matchKeys) {
|
|
|
1578
1635
|
}
|
|
1579
1636
|
return false;
|
|
1580
1637
|
}
|
|
1638
|
+
async function loadAllCheckSuitesPassed(args) {
|
|
1639
|
+
const suites = [];
|
|
1640
|
+
let totalCount = 0;
|
|
1641
|
+
for (let page = 1; page <= MAX_CHECK_SUITE_PAGES; page += 1) {
|
|
1642
|
+
const response = checkSuitesListResponseSchema.parse(
|
|
1643
|
+
await githubRequest(
|
|
1644
|
+
"https://api.github.com",
|
|
1645
|
+
`/repos/${encodeURIComponent(args.owner)}/${encodeURIComponent(args.repoName)}/commits/${args.headSha}/check-suites?per_page=100&page=${page}`,
|
|
1646
|
+
{ token: args.token }
|
|
1647
|
+
)
|
|
1648
|
+
);
|
|
1649
|
+
suites.push(...response.check_suites);
|
|
1650
|
+
totalCount = response.total_count;
|
|
1651
|
+
if (suites.length >= totalCount || response.check_suites.length === 0) {
|
|
1652
|
+
break;
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
if (suites.length < totalCount) return false;
|
|
1656
|
+
return suites.every(
|
|
1657
|
+
(suite) => suite.id === args.checkSuiteId || suite.status === "queued" && suite.latest_check_runs_count === 0 && suite.app?.slug !== "github-actions" || suite.status === "completed" && PASSING_SUITE_CONCLUSIONS.has(suite.conclusion ?? "")
|
|
1658
|
+
);
|
|
1659
|
+
}
|
|
1581
1660
|
async function loadCheckSuiteFacts(args) {
|
|
1582
1661
|
const target = parseCheckSuiteFactsTarget(args.body, {
|
|
1662
|
+
loadCheckSuites: args.loadCheckSuites,
|
|
1583
1663
|
loadPullRequestFacts: args.loadPullRequestFacts
|
|
1584
1664
|
});
|
|
1585
1665
|
if (!target) return void 0;
|
|
@@ -1609,6 +1689,36 @@ async function loadCheckSuiteFacts(args) {
|
|
|
1609
1689
|
});
|
|
1610
1690
|
}
|
|
1611
1691
|
}
|
|
1692
|
+
if (target.loadCheckSuites) {
|
|
1693
|
+
try {
|
|
1694
|
+
const token = await issueInstallationToken({
|
|
1695
|
+
appIdEnv: args.appIdEnv,
|
|
1696
|
+
installationIdEnv: args.installationIdEnv,
|
|
1697
|
+
permissions: { checks: "read" },
|
|
1698
|
+
privateKeyEnv: args.privateKeyEnv,
|
|
1699
|
+
repositories: [target.repoName]
|
|
1700
|
+
});
|
|
1701
|
+
if (await loadAllCheckSuitesPassed({
|
|
1702
|
+
checkSuiteId: target.checkSuiteId,
|
|
1703
|
+
headSha: target.headSha,
|
|
1704
|
+
owner: target.owner,
|
|
1705
|
+
repoName: target.repoName,
|
|
1706
|
+
token: token.token
|
|
1707
|
+
})) {
|
|
1708
|
+
facts.allCheckSuitesPassed = true;
|
|
1709
|
+
}
|
|
1710
|
+
} catch (error) {
|
|
1711
|
+
logFailOpenFailure(
|
|
1712
|
+
args.log,
|
|
1713
|
+
"GitHub commit check suites load failed",
|
|
1714
|
+
error,
|
|
1715
|
+
{
|
|
1716
|
+
checkSuiteId: target.checkSuiteId,
|
|
1717
|
+
repository: `${target.owner}/${target.repoName}`
|
|
1718
|
+
}
|
|
1719
|
+
);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1612
1722
|
if (target.loadFailingChecks && args.loadGitHubIncidents) {
|
|
1613
1723
|
try {
|
|
1614
1724
|
const incidents = await args.loadGitHubIncidents();
|
|
@@ -1672,7 +1782,7 @@ async function loadCheckSuiteFacts(args) {
|
|
|
1672
1782
|
);
|
|
1673
1783
|
}
|
|
1674
1784
|
}
|
|
1675
|
-
return facts.failingChecks || facts.pullRequestFactsByNumber ? facts : void 0;
|
|
1785
|
+
return facts.failingChecks || facts.allCheckSuitesPassed || facts.pullRequestFactsByNumber ? facts : void 0;
|
|
1676
1786
|
}
|
|
1677
1787
|
|
|
1678
1788
|
// src/webhooks/issue-update.ts
|
|
@@ -2500,6 +2610,7 @@ export {
|
|
|
2500
2610
|
logFailOpenFailure,
|
|
2501
2611
|
checkSuitePullRequests,
|
|
2502
2612
|
parseCheckSuitePublishTargets,
|
|
2613
|
+
wantsCheckSuitePassed,
|
|
2503
2614
|
needsCheckSuitePullRequestFacts,
|
|
2504
2615
|
loadCheckSuiteFacts,
|
|
2505
2616
|
gitHubPullRequestTerminalEvents,
|
package/dist/clone-command.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Git global options that take the next token as their value. */
|
|
2
|
+
export declare const GIT_OPTIONS_WITH_VALUE: Set<string>;
|
|
1
3
|
/**
|
|
2
4
|
* Return a redirect message when a bash command clones a GitHub repository
|
|
3
5
|
* without `github_cloneRepository`. Return undefined for other commands.
|
package/dist/db/schema.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export declare const githubPullRequestStateSchema: z.ZodEnum<{
|
|
|
5
5
|
open: "open";
|
|
6
6
|
}>;
|
|
7
7
|
export type GitHubPullRequestState = z.output<typeof githubPullRequestStateSchema>;
|
|
8
|
+
/**
|
|
9
|
+
* What waits on the requester of a Junior pull request: merge it, or review
|
|
10
|
+
* it. They take one, not both.
|
|
11
|
+
*/
|
|
12
|
+
export type GitHubPullRequestAction = "merge" | "review";
|
|
8
13
|
export declare const githubPullRequestCommitCompositionSchema: z.ZodEnum<{
|
|
9
14
|
junior_only: "junior_only";
|
|
10
15
|
mixed: "mixed";
|
|
@@ -469,23 +474,25 @@ export declare const juniorGitHubPullRequests: import("drizzle-orm/pg-core").PgT
|
|
|
469
474
|
identity: undefined;
|
|
470
475
|
generated: undefined;
|
|
471
476
|
}, {}, {}>;
|
|
472
|
-
|
|
473
|
-
name: "
|
|
477
|
+
nextAction: import("drizzle-orm/pg-core").PgColumn<{
|
|
478
|
+
name: "next_action";
|
|
474
479
|
tableName: "junior_github_pull_requests";
|
|
475
|
-
dataType: "
|
|
476
|
-
columnType: "
|
|
477
|
-
data:
|
|
480
|
+
dataType: "string";
|
|
481
|
+
columnType: "PgText";
|
|
482
|
+
data: GitHubPullRequestAction;
|
|
478
483
|
driverParam: string;
|
|
479
484
|
notNull: false;
|
|
480
485
|
hasDefault: false;
|
|
481
486
|
isPrimaryKey: false;
|
|
482
487
|
isAutoincrement: false;
|
|
483
488
|
hasRuntimeDefault: false;
|
|
484
|
-
enumValues:
|
|
489
|
+
enumValues: [string, ...string[]];
|
|
485
490
|
baseColumn: never;
|
|
486
491
|
identity: undefined;
|
|
487
492
|
generated: undefined;
|
|
488
|
-
}, {}, {
|
|
493
|
+
}, {}, {
|
|
494
|
+
$type: GitHubPullRequestAction;
|
|
495
|
+
}>;
|
|
489
496
|
readySyncRequests: import("drizzle-orm/pg-core").PgColumn<{
|
|
490
497
|
name: "ready_sync_requests";
|
|
491
498
|
tableName: "junior_github_pull_requests";
|
|
@@ -1329,23 +1336,25 @@ export declare const githubSqlSchema: {
|
|
|
1329
1336
|
identity: undefined;
|
|
1330
1337
|
generated: undefined;
|
|
1331
1338
|
}, {}, {}>;
|
|
1332
|
-
|
|
1333
|
-
name: "
|
|
1339
|
+
nextAction: import("drizzle-orm/pg-core").PgColumn<{
|
|
1340
|
+
name: "next_action";
|
|
1334
1341
|
tableName: "junior_github_pull_requests";
|
|
1335
|
-
dataType: "
|
|
1336
|
-
columnType: "
|
|
1337
|
-
data:
|
|
1342
|
+
dataType: "string";
|
|
1343
|
+
columnType: "PgText";
|
|
1344
|
+
data: GitHubPullRequestAction;
|
|
1338
1345
|
driverParam: string;
|
|
1339
1346
|
notNull: false;
|
|
1340
1347
|
hasDefault: false;
|
|
1341
1348
|
isPrimaryKey: false;
|
|
1342
1349
|
isAutoincrement: false;
|
|
1343
1350
|
hasRuntimeDefault: false;
|
|
1344
|
-
enumValues:
|
|
1351
|
+
enumValues: [string, ...string[]];
|
|
1345
1352
|
baseColumn: never;
|
|
1346
1353
|
identity: undefined;
|
|
1347
1354
|
generated: undefined;
|
|
1348
|
-
}, {}, {
|
|
1355
|
+
}, {}, {
|
|
1356
|
+
$type: GitHubPullRequestAction;
|
|
1357
|
+
}>;
|
|
1349
1358
|
readySyncRequests: import("drizzle-orm/pg-core").PgColumn<{
|
|
1350
1359
|
name: "ready_sync_requests";
|
|
1351
1360
|
tableName: "junior_github_pull_requests";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a draft needs before Junior marks it ready: the code owners that
|
|
3
|
+
* GitHub asks to review, and the repository's AGENTS.md, which can ask that
|
|
4
|
+
* pull requests stay drafts for a person to mark ready.
|
|
5
|
+
*
|
|
6
|
+
* GitHub reads the first CODEOWNERS file of the base branch, in `.github/`,
|
|
7
|
+
* the repository root, or `docs/`. For each changed file the last matching
|
|
8
|
+
* rule wins, and a matching rule with no owners leaves the file without
|
|
9
|
+
* owners. GitHub asks the owners to review when the pull request is ready for
|
|
10
|
+
* review, so a draft has not asked them yet.
|
|
11
|
+
*
|
|
12
|
+
* CODEOWNERS uses gitignore patterns, which the `ignore` package matches.
|
|
13
|
+
* One difference: GitHub matches `docs/*` only to files directly in `docs/`,
|
|
14
|
+
* and gitignore also matches the files below. That error finds too many
|
|
15
|
+
* owners, never too few, so Junior does not ping owners it did not expect.
|
|
16
|
+
*/
|
|
17
|
+
import type { PluginEgress } from "@sentry/junior-plugin-api";
|
|
18
|
+
/**
|
|
19
|
+
* Read the code owners of the files that one draft changes and the root
|
|
20
|
+
* AGENTS.md, both from its base branch.
|
|
21
|
+
*/
|
|
22
|
+
export declare function readDraftReadiness(egress: PluginEgress, repo: {
|
|
23
|
+
name: string;
|
|
24
|
+
owner: string;
|
|
25
|
+
}, pullRequest: {
|
|
26
|
+
base: string;
|
|
27
|
+
number: number;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
agentsMd?: string;
|
|
30
|
+
codeOwners: string[];
|
|
31
|
+
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type SubscribableResource } from "@sentry/junior-plugin-api";
|
|
2
|
-
export declare const GITHUB_PULL_REQUEST_EVENTS: readonly ["pull_request.checks.failed", "pull_request.checks.recovered", "pull_request.comment.created", "pull_request.opened", "pull_request.ready_for_review", "pull_request.review.approved", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
|
|
2
|
+
export declare const GITHUB_PULL_REQUEST_EVENTS: readonly ["pull_request.checks.failed", "pull_request.checks.passed", "pull_request.checks.recovered", "pull_request.comment.created", "pull_request.opened", "pull_request.ready_for_review", "pull_request.review.approved", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
|
|
3
3
|
export type GitHubPullRequestEvent = (typeof GITHUB_PULL_REQUEST_EVENTS)[number];
|
|
4
4
|
/** Combine provider defaults with app guidance for pull request events. */
|
|
5
5
|
export declare function gitHubPullRequestEventGuidance(guidance?: Partial<Record<GitHubPullRequestEvent, string>>): Partial<Record<GitHubPullRequestEvent, string>>;
|
|
@@ -9,7 +9,7 @@ export declare function gitHubRepositoryResource(input: {
|
|
|
9
9
|
repo: string;
|
|
10
10
|
}): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
|
|
11
11
|
/** Events that a repository Watch gets: deployments, issues, and pull requests. */
|
|
12
|
-
export declare const GITHUB_REPOSITORY_EVENTS: readonly ["deployment.created", "deployment.queued", "deployment.pending", "deployment.in_progress", "deployment.succeeded", "deployment.failed", "deployment.error", ...string[], "pull_request.checks.failed", "pull_request.checks.recovered", "pull_request.comment.created", "pull_request.opened", "pull_request.ready_for_review", "pull_request.review.approved", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
|
|
12
|
+
export declare const GITHUB_REPOSITORY_EVENTS: readonly ["deployment.created", "deployment.queued", "deployment.pending", "deployment.in_progress", "deployment.succeeded", "deployment.failed", "deployment.error", ...string[], "pull_request.checks.failed", "pull_request.checks.passed", "pull_request.checks.recovered", "pull_request.comment.created", "pull_request.opened", "pull_request.ready_for_review", "pull_request.review.approved", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
|
|
13
13
|
/** Repository events to suggest when a conversation starts a Watch. */
|
|
14
14
|
export declare const GITHUB_REPOSITORY_SUGGESTED_EVENTS: readonly ["issue.opened", "pull_request.opened", ...string[], "pull_request.checks.failed", "pull_request.comment.created", "pull_request.ready_for_review", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
|
|
15
15
|
/**
|
|
@@ -22,8 +22,21 @@ export declare const RESOLVE_REVIEW_THREAD: GitHubGraphqlOperation;
|
|
|
22
22
|
* commit, with whether each check is required.
|
|
23
23
|
*/
|
|
24
24
|
export declare const PULL_REQUEST_CHECKS: GitHubGraphqlOperation;
|
|
25
|
+
/**
|
|
26
|
+
* Read the CODEOWNERS files and the root AGENTS.md of a base branch, and one
|
|
27
|
+
* page of the files that a pull request changes. Each `*Expression` is
|
|
28
|
+
* `<base>:<path>`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const PULL_REQUEST_DRAFT_READINESS: GitHubGraphqlOperation;
|
|
25
31
|
/** Read one page of a pull request search, with mergeability. */
|
|
26
32
|
export declare const OPEN_PULL_REQUEST_MERGEABILITY: GitHubGraphqlOperation;
|
|
33
|
+
/**
|
|
34
|
+
* Read what decides a merge conflict fix on one pull request: the review
|
|
35
|
+
* decision, when it opened, and its latest pushes, reviews, and comments.
|
|
36
|
+
* Pushes have their own window, so comments, which anyone can add, cannot
|
|
37
|
+
* push Junior's earlier fixes out of it.
|
|
38
|
+
*/
|
|
39
|
+
export declare const PULL_REQUEST_CONFLICT_HISTORY: GitHubGraphqlOperation;
|
|
27
40
|
/**
|
|
28
41
|
* Return the query that reads the lifecycle of `count` pull requests of one
|
|
29
42
|
* repository. Pull request `i` has the alias `pr<i>` and the variable `$n<i>`.
|