@intentius/chant 0.124.79 → 0.124.80
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/ci-note-commands.d.ts +199 -0
- package/dist/ci-note-commands.d.ts.map +1 -0
- package/dist/ci-note-commands.js +372 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +7 -1
- package/dist/cli/handlers/pr-notes.d.ts +13 -0
- package/dist/cli/handlers/pr-notes.d.ts.map +1 -0
- package/dist/cli/handlers/pr-notes.js +73 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +10 -1
- package/dist/cli/mcp/product-tools.d.ts.map +1 -1
- package/dist/cli/mcp/product-tools.js +1 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +10 -0
- package/dist/cli/registry.d.ts +4 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/capability.d.ts +11 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/pr-pipeline.d.ts +22 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +26 -0
- package/dist/components/product-pipeline.d.ts +12 -0
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +5 -1
- package/dist/lifecycle/release-version.d.ts.map +1 -1
- package/dist/lifecycle/release-version.js +1 -2
- package/dist/op/index.d.ts +2 -2
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -1
- package/dist/op/op-waves-after-plan.d.ts +33 -0
- package/dist/op/op-waves-after-plan.d.ts.map +1 -1
- package/dist/op/op-waves-after-plan.js +41 -3
- package/dist/op/op-waves-capability.d.ts +4 -1
- package/dist/op/op-waves-capability.d.ts.map +1 -1
- package/dist/op/op-waves-capability.js +14 -14
- package/dist/op/op-waves-run-hooks.d.ts.map +1 -1
- package/dist/op/op-waves-run-hooks.js +1 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +78 -12
- package/dist/pr-forge-reads.d.ts +151 -1
- package/dist/pr-forge-reads.d.ts.map +1 -1
- package/dist/pr-forge-reads.js +265 -1
- package/dist/release-floors.d.ts +15 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +17 -3
- package/dist/wave-runtime.mjs +272 -272
- package/package.json +1 -1
- package/src/ci-note-commands.test.ts +377 -0
- package/src/ci-note-commands.ts +479 -0
- package/src/cli/handlers/build.ts +7 -1
- package/src/cli/handlers/pr-notes.ts +70 -0
- package/src/cli/main.ts +10 -1
- package/src/cli/mcp/product-tools.test.ts +1 -2
- package/src/cli/mcp/product-tools.ts +1 -2
- package/src/cli/parse-args.ts +8 -0
- package/src/cli/registry.ts +4 -0
- package/src/components/capability.ts +11 -0
- package/src/components/pr-pipeline.ts +35 -0
- package/src/components/product-pipeline.test.ts +14 -0
- package/src/components/product-pipeline.ts +13 -1
- package/src/lifecycle/release-version.ts +1 -2
- package/src/op/index.ts +2 -2
- package/src/op/op-waves-after-plan-wave.test.ts +2 -3
- package/src/op/op-waves-after-plan.ts +61 -3
- package/src/op/op-waves-capability.test.ts +3 -1
- package/src/op/op-waves-capability.ts +17 -17
- package/src/op/op-waves-gate-port.test.ts +232 -0
- package/src/op/op-waves-run-hooks.test.ts +2 -3
- package/src/op/op-waves-run-hooks.ts +1 -2
- package/src/op/op-waves-run.ts +78 -14
- package/src/op/op-waves-step-wave.test.ts +3 -4
- package/src/pr-forge-reads-compare.test.ts +145 -0
- package/src/pr-forge-reads.test.ts +203 -0
- package/src/pr-forge-reads.ts +398 -1
- package/src/release-floors.ts +24 -3
package/dist/op/op-waves-run.js
CHANGED
|
@@ -74,7 +74,7 @@ import { gitOpWaveReleasePort } from "./op-waves-release-port.js";
|
|
|
74
74
|
import { gitOpWaveNewerCommit, opWaveStandDownReason, tipAppliesTargets } from "./op-waves-stand-down.js";
|
|
75
75
|
import { mapLimited } from "../parallelism.js";
|
|
76
76
|
import { applyOpWaveStep, opWaveCosts, opWaveCostVerdict, opWaveHoldsAt, opWaveHoldsProblems, opWavePolicyVerdicts, opWaveRegistry, opWaveStepChangeSet, planJsonOf, planOpWaveStep, planOpWaveStepGroup, discoverOpWaveStepRuns, applyOpWaveStepGroup, OP_WAVE_TOGETHER_MEMBER, } from "./op-waves-capability.js";
|
|
77
|
-
import { changeInvolvement, quorumProblems, quorumRuleLine, quorumRulesFor, quorumWaiting, recordedReviewApprovals, ruleNeedsProof, samePrincipal, trustQuorumJudge, } from "./gate-quorum.js";
|
|
77
|
+
import { changeInvolvement, quorumProblems, quorumRuleLine, quorumRulesFor, quorumWaiting, recordedReviewApprovals, recordedReviewOf, ruleNeedsProof, samePrincipal, trustQuorumJudge, } from "./gate-quorum.js";
|
|
78
78
|
import { OP_WAVE_DEFAULT_APPLY, OP_WAVE_GATE_POLICIES, OP_WAVE_HOOK_MOMENTS, GATE_APPROVAL_SOURCES, assertOpWaveHooks, assertOpWavesSpec, opWaveApplyHooksRunBy, opWaveGateName, opWaveHooksAt, opWaveOutcomeDir, opWavePointAt, opWavePointProblems, opWaveRecordPath, opWaveGroupRuns, opWaveGroupsProblem, opWaveShare, OP_LEDGER_NAME, opWavesInvolvedProblems, waveApproveTarget, } from "./op-waves.js";
|
|
79
79
|
import { OP_WAVE_PENDING_RESERVED, opWaveArgv, pendingFields, holdFinishedPath, readHoldFinished, readHoldRequest, runHookList, runHookListAsync, runStageHooks, runStageHooksAsync, spawnExec, spawnExecAsync, } from "./stage-hooks.js";
|
|
80
80
|
export { OP_WAVE_PENDING_RESERVED, opWaveArgv, runStageHooks, runStageHooksAsync, spawnExecAsync };
|
|
@@ -178,12 +178,13 @@ function quorumAtBase(spec, where) {
|
|
|
178
178
|
return { quorumRefused: `the approval rules in ${where} cannot be read (${bad.join("; ")})` };
|
|
179
179
|
extra.involved = structuredClone(a.involved);
|
|
180
180
|
}
|
|
181
|
+
// terragucci issue 1303: the review ledger and the involved count without rules too.
|
|
181
182
|
if (raw === undefined)
|
|
182
|
-
return
|
|
183
|
+
return extra;
|
|
183
184
|
const problems = Array.isArray(raw) ? quorumProblems(raw, "approvals.quorum", { notAuthor: true }) : ["`approvals.quorum` must be a list of rules"];
|
|
184
185
|
if (problems.length > 0)
|
|
185
186
|
return { quorumRefused: `the approval rules in ${where} cannot be read (${problems.join("; ")})` };
|
|
186
|
-
return raw.length > 0 ? { quorum: raw, ...extra } :
|
|
187
|
+
return raw.length > 0 ? { quorum: raw, ...extra } : extra;
|
|
187
188
|
}
|
|
188
189
|
/** The holds at base (#4545), or why they cannot be read. */
|
|
189
190
|
function holdsAtBase(spec, where) {
|
|
@@ -417,12 +418,12 @@ async function applyStepRun(ctx, registry, run, plan) {
|
|
|
417
418
|
const hooks = opWaveRunHookList(options.runHooks);
|
|
418
419
|
const env = ctx.runEnv?.get(run.target);
|
|
419
420
|
if (hooks.length === 0)
|
|
420
|
-
return applyOpWaveStep({ spec, wave, registry, ...(env ? { processEnv: env } : {}) }, run, plan);
|
|
421
|
+
return applyOpWaveStep({ spec, wave, registry, cwd: ctx.cwd, ...(env ? { processEnv: env } : {}) }, run, plan);
|
|
421
422
|
const planned = { ...runHookRun(ctx, run), planDigest: plan.planDigest, plan: opWavePlanPath(spec, k, run.target), ...(plan.artifact !== undefined ? { artifact: plan.artifact } : {}) };
|
|
422
423
|
const stop = await runOpWaveBeforeApply(hooks, planned);
|
|
423
424
|
if (stop !== undefined)
|
|
424
425
|
return { outcome: "failed", reason: stop };
|
|
425
|
-
const got = await applyOpWaveStep({ spec, wave, registry, ...(env ? { processEnv: env } : {}) }, run, plan);
|
|
426
|
+
const got = await applyOpWaveStep({ spec, wave, registry, cwd: ctx.cwd, ...(env ? { processEnv: env } : {}) }, run, plan);
|
|
426
427
|
const after = await runOpWaveAfterApply(hooks, { ...planned, outcome: got.outcome, ...(got.outcome === "applied" ? { output: got.output } : { reason: got.reason }) });
|
|
427
428
|
const files = after.files.length > 0 ? { files: after.files } : {};
|
|
428
429
|
if (after.failed && got.outcome === "applied")
|
|
@@ -446,7 +447,7 @@ async function planWaveRuns(at, runs, discover = false) {
|
|
|
446
447
|
// #4613: a step's own policy engine (CrossGuard) reads its packs at the base the wave's rules were read at.
|
|
447
448
|
const policyBase = base && base !== "HEAD" ? base : undefined;
|
|
448
449
|
// #4842: a discovering wave's runs are the ones its step's capability finds for wave k.
|
|
449
|
-
const found = discover ? await discoverOpWaveStepRuns({ spec, wave, k, registry }) : undefined;
|
|
450
|
+
const found = discover ? await discoverOpWaveStepRuns({ spec, wave, k, registry, cwd }) : undefined;
|
|
450
451
|
if (found)
|
|
451
452
|
runs = found.runs;
|
|
452
453
|
const plans = [];
|
|
@@ -1838,6 +1839,8 @@ async function planOpWave(options, { k, pass }, skip) {
|
|
|
1838
1839
|
}
|
|
1839
1840
|
if (answer?.report !== undefined)
|
|
1840
1841
|
ctx.report = answer.report;
|
|
1842
|
+
if (answer?.approvals.length)
|
|
1843
|
+
ctx.answerApprovals = answer.approvals;
|
|
1841
1844
|
if (wave.discover) {
|
|
1842
1845
|
wave = { ...wave, runs: members.map((m) => ({ target: m.member, ...(m.op !== spec.op ? { op: m.op } : {}) })) };
|
|
1843
1846
|
ctx.wave = wave;
|
|
@@ -1903,8 +1906,10 @@ async function decideOpWave(options, { prior }, planned, digest) {
|
|
|
1903
1906
|
decision.members = members;
|
|
1904
1907
|
// #4290: the rules at base whose targets glob matches one of the wave's runs.
|
|
1905
1908
|
const takes = planned.rules.quorum ? quorumRulesFor(planned.rules.quorum, members.map((m) => m.member)) : [];
|
|
1906
|
-
if (takes.length > 0)
|
|
1909
|
+
if (takes.length > 0)
|
|
1907
1910
|
decision.quorum = takes;
|
|
1911
|
+
// terragucci issue 1303: a wave no rule covers still leaves the involved out, and counts a review the product recorded.
|
|
1912
|
+
if (takes.length > 0 || opWaveOneApprover(decision.approval, planned.rules)) {
|
|
1908
1913
|
if (planned.rules.reviewLedger)
|
|
1909
1914
|
decision.reviewLedger = planned.rules.reviewLedger;
|
|
1910
1915
|
if (planned.rules.involved)
|
|
@@ -1969,6 +1974,9 @@ async function decideOpWave(options, { prior }, planned, digest) {
|
|
|
1969
1974
|
log(`wave ${k} (${wave.name}): planned again to the same digest, so the approval by ${was.approvedBy} still holds`);
|
|
1970
1975
|
}
|
|
1971
1976
|
else if (decision.status !== "refused" && (unseen || opWaveNeedsApproval(policy, members) || holds.length > 0)) {
|
|
1977
|
+
// terragucci issue 1303: what the product settled before the gate, recorded at it for these plans first.
|
|
1978
|
+
if (ctx.answerApprovals?.length)
|
|
1979
|
+
await recordAnswerApprovals(options, ctx, decision);
|
|
1972
1980
|
await settleGate(options, ctx, decision);
|
|
1973
1981
|
// Plans nobody previewed apply only under an approval of these very plans, whatever the gate policy says.
|
|
1974
1982
|
if (unseen)
|
|
@@ -2353,6 +2361,9 @@ async function settleGate(options, ctx, decision) {
|
|
|
2353
2361
|
return settlePointGate(options, ctx, decision, decision.point);
|
|
2354
2362
|
if (decision.quorum?.length)
|
|
2355
2363
|
return settleQuorumGate(options, ctx, decision, decision.quorum);
|
|
2364
|
+
// terragucci issue 1303: with no rule, `approvals.involved.exclude` and a review ledger still judge each approval, as one approver's rule does.
|
|
2365
|
+
if ((decision.involved?.exclude || decision.reviewLedger) && decision.approval !== "pull-request")
|
|
2366
|
+
return settleQuorumGate(options, ctx, decision, [{ count: 1 }], true);
|
|
2356
2367
|
const { spec, k, wave, cwd } = ctx;
|
|
2357
2368
|
const { gate, digest, approval, base, policy, members } = decision;
|
|
2358
2369
|
// #4574: the run target a product's approve line names.
|
|
@@ -2508,7 +2519,7 @@ const gitCommitsBetween = (cwd) => (base, head) => {
|
|
|
2508
2519
|
* the same pull request; with none, no approver can show they are someone
|
|
2509
2520
|
* else and the rule waits.
|
|
2510
2521
|
*/
|
|
2511
|
-
async function settleQuorumGate(options, ctx, decision, rules) {
|
|
2522
|
+
async function settleQuorumGate(options, ctx, decision, rules, oneApprover = false) {
|
|
2512
2523
|
const { spec, k, wave, cwd, log } = ctx;
|
|
2513
2524
|
const { gate, digest, approval, base, policy, members } = decision;
|
|
2514
2525
|
const { ledger, port } = await gatePort(options, cwd, gate, approval, base);
|
|
@@ -2617,7 +2628,10 @@ async function settleQuorumGate(options, ctx, decision, rules) {
|
|
|
2617
2628
|
...(reviewed ? { review: reviewed } : {}),
|
|
2618
2629
|
...(recorded.length > 0 ? { recorded } : {}),
|
|
2619
2630
|
});
|
|
2620
|
-
|
|
2631
|
+
// terragucci issue 1303: on the spec's own ledger a product's review line names every reviewer in one approver, and each reviewer counts on their own line.
|
|
2632
|
+
const judge = (r) => decision.reviewLedger === spec.name && recordedReviewOf(r) !== null
|
|
2633
|
+
? { proven: false, roles: [], excluded: `the review line by ${r.resolvedBy} counts each of its reviewers on their own` }
|
|
2634
|
+
: sayExcluded(judgeBase(r));
|
|
2621
2635
|
const held = decision.heldBy?.length ? `, held by ${decision.heldBy.join(", ")}` : "";
|
|
2622
2636
|
const check = await decideWaveGate(port, {
|
|
2623
2637
|
op: spec.name,
|
|
@@ -2637,7 +2651,7 @@ async function settleQuorumGate(options, ctx, decision, rules) {
|
|
|
2637
2651
|
decision.via = reviewed && check.resolution.review?.head === reviewed.head ? "pr-review" : "ledger";
|
|
2638
2652
|
decision.approvedBy = by.join(", ");
|
|
2639
2653
|
decision.approvedAt = check.resolution.timestamp;
|
|
2640
|
-
log(`${label}: the approval rules at ${base.slice(0, 12)} are met by ${by.join(", ")}`);
|
|
2654
|
+
log(oneApprover ? `${label}: approved by ${by.join(", ")}, who had no hand in the change` : `${label}: the approval rules at ${base.slice(0, 12)} are met by ${by.join(", ")}`);
|
|
2641
2655
|
return;
|
|
2642
2656
|
}
|
|
2643
2657
|
logRefused(log, label, check);
|
|
@@ -2646,7 +2660,9 @@ async function settleQuorumGate(options, ctx, decision, rules) {
|
|
|
2646
2660
|
decision.waitingSince = check.pending.timestamp;
|
|
2647
2661
|
if (check.mismatch)
|
|
2648
2662
|
decision.mismatch = check.mismatch;
|
|
2649
|
-
if (
|
|
2663
|
+
if (oneApprover)
|
|
2664
|
+
log(`${label}: no approval of ${digest} counts once the people behind the change are left out, so it waits for one`);
|
|
2665
|
+
else if (check.quorum?.rules) {
|
|
2650
2666
|
decision.quorumProgress = check.quorum.rules;
|
|
2651
2667
|
for (const p of check.quorum.rules)
|
|
2652
2668
|
log(`${label}: approval rule ${quorumRuleLine(p)}`);
|
|
@@ -3185,7 +3201,7 @@ async function applyStepRunsTogether(options, ctx, runs) {
|
|
|
3185
3201
|
result.failed.push(...runs.map((r) => r.target));
|
|
3186
3202
|
return;
|
|
3187
3203
|
}
|
|
3188
|
-
const got = await applyOpWaveStepGroup({ spec, wave, registry, runEnv: (target) => ctx.runEnv?.get(target) }, planned);
|
|
3204
|
+
const got = await applyOpWaveStepGroup({ spec, wave, registry, cwd: ctx.cwd, runEnv: (target) => ctx.runEnv?.get(target) }, planned);
|
|
3189
3205
|
for (const [i, p] of planned.entries()) {
|
|
3190
3206
|
let outcome = got[i];
|
|
3191
3207
|
let files;
|
|
@@ -3498,3 +3514,53 @@ async function writeHeadPlans(plans, cwd) {
|
|
|
3498
3514
|
if (!pushed.pushed)
|
|
3499
3515
|
throw new Error(`the plans were recorded locally only: ${pushed.pushWarning ?? "chant/lifecycle has no remote to push to"}`);
|
|
3500
3516
|
}
|
|
3517
|
+
/**
|
|
3518
|
+
* Whether a wave no approval rule covers is still judged approver by
|
|
3519
|
+
* approver (terragucci issue 1303): `approvals.involved.exclude`, or a
|
|
3520
|
+
* review ledger under `pr-review`, at base. Not under `pull-request`, whose
|
|
3521
|
+
* approval is the pull request's gate.
|
|
3522
|
+
*/
|
|
3523
|
+
function opWaveOneApprover(approval, rules) {
|
|
3524
|
+
if (approval === "pull-request")
|
|
3525
|
+
return false;
|
|
3526
|
+
return rules.involved?.exclude === true || (rules.reviewLedger !== undefined && approval === "pr-review");
|
|
3527
|
+
}
|
|
3528
|
+
/**
|
|
3529
|
+
* Record the approvals the after-plan hooks settled before the gate
|
|
3530
|
+
* (terragucci issue 1303) at the wave's gate, for the digest it decides, on
|
|
3531
|
+
* the spec's op. An approval already recorded for the digest by the same
|
|
3532
|
+
* approver with the same note is not written again. A gate that asks a
|
|
3533
|
+
* decision point records none: only its answer passes the wave.
|
|
3534
|
+
*/
|
|
3535
|
+
async function recordAnswerApprovals(options, ctx, decision) {
|
|
3536
|
+
const { spec, k, wave, cwd, log } = ctx;
|
|
3537
|
+
const label = `wave ${k} (${wave.name})`;
|
|
3538
|
+
const approvals = ctx.answerApprovals ?? [];
|
|
3539
|
+
if (decision.point) {
|
|
3540
|
+
log(`${label}: the gate asks a decision point, so the ${approvals.length} approval${approvals.length === 1 ? "" : "s"} the after-plan hooks gave ${approvals.length === 1 ? "is" : "are"} not recorded`);
|
|
3541
|
+
return;
|
|
3542
|
+
}
|
|
3543
|
+
const ledger = options.gates ?? gitGateLedgerPort({ cwd });
|
|
3544
|
+
if (!ledger.appendResolution) {
|
|
3545
|
+
log(`${label}: the gate ledger takes no approvals, so the ones the after-plan hooks gave are not recorded`);
|
|
3546
|
+
return;
|
|
3547
|
+
}
|
|
3548
|
+
const now = options.now ?? new Date().toISOString();
|
|
3549
|
+
const had = (await ledger.read(spec.name)).resolutions.filter((r) => r.gate === decision.gate && samePlanDigest(r.planDigest, decision.digest));
|
|
3550
|
+
for (const a of approvals) {
|
|
3551
|
+
if (had.some((r) => r.resolvedBy === a.resolvedBy && r.note === a.note))
|
|
3552
|
+
continue;
|
|
3553
|
+
const review = a.review ? { via: "pr-review", pr: a.review.pr, head: a.review.head, reviewers: a.review.reviewers } : {};
|
|
3554
|
+
await ledger.appendResolution({
|
|
3555
|
+
op: spec.name,
|
|
3556
|
+
gate: decision.gate,
|
|
3557
|
+
resolvedBy: a.resolvedBy,
|
|
3558
|
+
timestamp: now,
|
|
3559
|
+
planDigest: decision.digest,
|
|
3560
|
+
note: a.note,
|
|
3561
|
+
...(a.url ? { url: a.url } : {}),
|
|
3562
|
+
...review,
|
|
3563
|
+
});
|
|
3564
|
+
log(`${label}: ${a.resolvedBy}'s approval recorded for ${decision.digest}: ${a.note}`);
|
|
3565
|
+
}
|
|
3566
|
+
}
|
package/dist/pr-forge-reads.d.ts
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* state and merge commit, the pull requests from a branch (or a branch
|
|
5
5
|
* prefix) in any state, every note on a pull request, GitHub's check runs on
|
|
6
6
|
* a commit, a pull request's commits, a collaborator's permission level, and
|
|
7
|
-
* every open pull request in the repository
|
|
7
|
+
* every open pull request in the repository; and a head's workflow runs
|
|
8
|
+
* (GitLab's pipelines), a run, its jobs, and the artifacts it kept, by name in
|
|
9
|
+
* a run or across the repository, as a product's review agent reads them
|
|
10
|
+
* (#4846); the files a head changes since its merge base, a job by id, and
|
|
11
|
+
* a file of a GitLab job's artifacts (#4862).
|
|
8
12
|
*
|
|
9
13
|
* They take the same options as the clients in `./pr-forge.ts` and live in
|
|
10
14
|
* their own module, imported only by the products that call them, so the
|
|
@@ -84,6 +88,120 @@ export interface PullRequestsFromOptions {
|
|
|
84
88
|
/** At most this many pull requests are read, newest update first. Default 500. */
|
|
85
89
|
limit?: number;
|
|
86
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* A workflow run (#4846): a GitHub or Forgejo Actions run, or a GitLab
|
|
93
|
+
* pipeline.
|
|
94
|
+
*/
|
|
95
|
+
export interface WorkflowRun {
|
|
96
|
+
id: number;
|
|
97
|
+
/**
|
|
98
|
+
* The event that started it. GitHub's `event`. Forgejo's `trigger_event`,
|
|
99
|
+
* the workflow's own trigger: Forgejo lists a `pull_request_target` run
|
|
100
|
+
* with `event: pull_request`, which is {@link listedEvent}. GitLab's
|
|
101
|
+
* `source` (`merge_request_event`, `push`, `schedule`, `api`, ...).
|
|
102
|
+
*/
|
|
103
|
+
event: string;
|
|
104
|
+
/** The event as the forge lists it, when that differs from {@link event} (Forgejo's `event` beside its `trigger_event`). */
|
|
105
|
+
listedEvent?: string;
|
|
106
|
+
/** The workflow's file name, such as `pipeline.yml`: the last part of GitHub's `path`, Forgejo's `workflow_id`. GitLab has none. */
|
|
107
|
+
workflow?: string;
|
|
108
|
+
/** GitHub's workflow path without its `@ref`, such as `.github/workflows/pipeline.yml`. */
|
|
109
|
+
path?: string;
|
|
110
|
+
/** The commit it ran on. */
|
|
111
|
+
headSha: string;
|
|
112
|
+
/** The branch it ran on (GitLab's `ref`, which for a merge request pipeline is `refs/merge-requests/<iid>/head`). */
|
|
113
|
+
headBranch?: string;
|
|
114
|
+
/** The repository its head is in, as `owner/name` (GitHub's `head_repository`), when the forge names it. */
|
|
115
|
+
headRepo?: string;
|
|
116
|
+
/** The forge's word for where it is: GitHub's `queued`, `in_progress`, `completed`; Forgejo's and GitLab's `running`, `success`, `failure` or `failed`, ... */
|
|
117
|
+
status: string;
|
|
118
|
+
/** GitHub's conclusion once completed. */
|
|
119
|
+
conclusion?: string;
|
|
120
|
+
/** It finished, whatever its outcome. */
|
|
121
|
+
done: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* The pull requests the run names: GitHub's `pull_requests`, the
|
|
124
|
+
* `pull_request` of Forgejo's `event_payload`, GitLab's merge request when
|
|
125
|
+
* the pipeline is one's. `base` is the base branch the event named.
|
|
126
|
+
*/
|
|
127
|
+
pullRequests: {
|
|
128
|
+
number: number;
|
|
129
|
+
head?: string;
|
|
130
|
+
headSha?: string;
|
|
131
|
+
base?: string;
|
|
132
|
+
}[];
|
|
133
|
+
url?: string;
|
|
134
|
+
}
|
|
135
|
+
/** One of a run's jobs. */
|
|
136
|
+
export interface RunJob {
|
|
137
|
+
id: number;
|
|
138
|
+
name: string;
|
|
139
|
+
status: string;
|
|
140
|
+
conclusion?: string;
|
|
141
|
+
done: boolean;
|
|
142
|
+
/** The run (pipeline) it belongs to, when the forge names it (#4862). */
|
|
143
|
+
run?: number;
|
|
144
|
+
/** The branch or ref it ran on: GitHub's and Forgejo's `head_branch`, GitLab's `ref`. */
|
|
145
|
+
ref?: string;
|
|
146
|
+
/** GitLab only: true when it ran for a tag. */
|
|
147
|
+
tag?: boolean;
|
|
148
|
+
/** The job's page on the forge. */
|
|
149
|
+
url?: string;
|
|
150
|
+
}
|
|
151
|
+
/** A file a comparison changes, with the path it had before a rename when the forge names it (#4862). */
|
|
152
|
+
export interface ChangedFile {
|
|
153
|
+
path: string;
|
|
154
|
+
previousPath?: string;
|
|
155
|
+
}
|
|
156
|
+
/** What {@link ForgeReads.compare} reads. */
|
|
157
|
+
export interface Comparison {
|
|
158
|
+
files: ChangedFile[];
|
|
159
|
+
/**
|
|
160
|
+
* True when the forge may have left files out: GitHub lists at most 300,
|
|
161
|
+
* Forgejo listed fewer commits than it counts or a commit without its
|
|
162
|
+
* files, GitLab's compare timed out.
|
|
163
|
+
*/
|
|
164
|
+
truncated: boolean;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* An artifact a run kept, not expired. On GitLab, a job's artifacts archive:
|
|
168
|
+
* `id` is the job's id and `name` its name.
|
|
169
|
+
*/
|
|
170
|
+
export interface RunArtifact {
|
|
171
|
+
id: number;
|
|
172
|
+
name: string;
|
|
173
|
+
/** The run that kept it, when the forge names it. */
|
|
174
|
+
run?: number;
|
|
175
|
+
/** The commit that run ran on, when the forge names it. */
|
|
176
|
+
headSha?: string;
|
|
177
|
+
size?: number;
|
|
178
|
+
}
|
|
179
|
+
/** What {@link ForgeReads.headRuns} reads. */
|
|
180
|
+
export interface HeadRunsOptions {
|
|
181
|
+
/** Only runs of this event (GitHub's and Forgejo's `event`, GitLab's `source`). */
|
|
182
|
+
event?: string;
|
|
183
|
+
/** At most this many runs. Default 100. */
|
|
184
|
+
limit?: number;
|
|
185
|
+
}
|
|
186
|
+
/** What {@link ForgeReads.branchRuns} reads. */
|
|
187
|
+
export interface BranchRunsOptions {
|
|
188
|
+
/** Only runs of this event (GitHub's and Forgejo's `event`, GitLab's `source`). */
|
|
189
|
+
event?: string;
|
|
190
|
+
/** At most this many runs. Default 100. */
|
|
191
|
+
limit?: number;
|
|
192
|
+
}
|
|
193
|
+
/** What {@link ForgeReads.pullRequestsUpdated} reads. */
|
|
194
|
+
export interface PullRequestsUpdatedOptions {
|
|
195
|
+
/** At most this many pull requests. Default 500. */
|
|
196
|
+
limit?: number;
|
|
197
|
+
}
|
|
198
|
+
/** What {@link ForgeReads.artifacts} reads. */
|
|
199
|
+
export interface ArtifactsOptions {
|
|
200
|
+
/** Only the artifacts this run (pipeline) kept. Without it, the repository's. */
|
|
201
|
+
run?: number;
|
|
202
|
+
/** At most this many artifacts. Default 100. */
|
|
203
|
+
limit?: number;
|
|
204
|
+
}
|
|
87
205
|
/** The reads, for GitHub, Forgejo and GitLab alike. */
|
|
88
206
|
export interface ForgeReads {
|
|
89
207
|
kind: ForgeKind;
|
|
@@ -112,6 +230,38 @@ export interface ForgeReads {
|
|
|
112
230
|
permission(login: string): Promise<string | undefined>;
|
|
113
231
|
/** Every open pull request in the repository, into any base, ascending by number. */
|
|
114
232
|
openPullRequests(): Promise<OpenPullRequest[]>;
|
|
233
|
+
/** The workflow runs (GitLab's pipelines) on commit `sha`, newest first (#4846). */
|
|
234
|
+
headRuns(sha: string, opts?: HeadRunsOptions): Promise<WorkflowRun[]>;
|
|
235
|
+
/** The workflow runs (GitLab's pipelines) on branch `branch`, newest first (#4785). */
|
|
236
|
+
branchRuns(branch: string, opts?: BranchRunsOptions): Promise<WorkflowRun[]>;
|
|
237
|
+
/**
|
|
238
|
+
* The pull requests in any state updated at or after `since` (ISO 8601),
|
|
239
|
+
* forks' among them, newest update first (#4785): what a poll of comment
|
|
240
|
+
* commands reads.
|
|
241
|
+
*/
|
|
242
|
+
pullRequestsUpdated(since: string, opts?: PullRequestsUpdatedOptions): Promise<PullRequestDetail[]>;
|
|
243
|
+
/** A workflow run (pipeline), or undefined when the forge has none by that id. */
|
|
244
|
+
run(id: number): Promise<WorkflowRun | undefined>;
|
|
245
|
+
/** A run's jobs, in the order the forge lists them. */
|
|
246
|
+
runJobs(run: number): Promise<RunJob[]>;
|
|
247
|
+
/** The artifacts named `name` that are not expired, in a run or across the repository, newest first. */
|
|
248
|
+
artifacts(name: string, opts?: ArtifactsOptions): Promise<RunArtifact[]>;
|
|
249
|
+
/**
|
|
250
|
+
* The files `head` changes since its merge base with `base` (#4862):
|
|
251
|
+
* GitHub's and Forgejo's `compare/<base>...<head>`, GitLab's
|
|
252
|
+
* `repository/compare` with `straight=false`. Forgejo names each commit's
|
|
253
|
+
* files, without a rename's old path, so a file a later commit changes
|
|
254
|
+
* back is still listed.
|
|
255
|
+
*/
|
|
256
|
+
compare(base: string, head: string): Promise<Comparison>;
|
|
257
|
+
/** A job by id, or undefined when the forge has none by that id (#4862). */
|
|
258
|
+
job(id: number): Promise<RunJob | undefined>;
|
|
259
|
+
/**
|
|
260
|
+
* GitLab only: one file of a job's artifacts, as text, or undefined when
|
|
261
|
+
* the job kept no such file (#4862). GitHub and Forgejo hand an artifact
|
|
262
|
+
* out as one archive.
|
|
263
|
+
*/
|
|
264
|
+
artifactFile?(job: number, path: string): Promise<string | undefined>;
|
|
115
265
|
}
|
|
116
266
|
/** The reads for a GitHub client's options. */
|
|
117
267
|
export declare function githubReads(opts: GithubForgeOptions): ForgeReads;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-forge-reads.d.ts","sourceRoot":"","sources":["../src/pr-forge-reads.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pr-forge-reads.d.ts","sourceRoot":"","sources":["../src/pr-forge-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AAEpB,iHAAiH;AACjH,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,iF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