@intentius/chant 0.124.89 → 0.124.91
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/actor.d.ts +5 -3
- package/dist/actor.d.ts.map +1 -1
- package/dist/actor.js +7 -5
- package/dist/audit/core.d.ts.map +1 -1
- package/dist/audit/core.js +11 -1
- package/dist/ci-comment-commands.d.ts +18 -2
- package/dist/ci-comment-commands.d.ts.map +1 -1
- package/dist/ci-comment-commands.js +30 -2
- package/dist/ci-job-guard.d.ts +42 -45
- package/dist/ci-job-guard.d.ts.map +1 -1
- package/dist/ci-job-guard.js +206 -3
- package/dist/ci-note-commands.d.ts +41 -1
- package/dist/ci-note-commands.d.ts.map +1 -1
- package/dist/ci-note-commands.js +64 -5
- package/dist/ci-product.d.ts +50 -1
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +52 -6
- package/dist/cli/handlers/pr-comment.d.ts +13 -1
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -1
- package/dist/cli/handlers/pr-comment.js +90 -1
- package/dist/cli/handlers/pr-notes.d.ts.map +1 -1
- package/dist/cli/handlers/pr-notes.js +23 -1
- package/dist/cli/handlers/pr.d.ts +2 -2
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +41 -20
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +154 -4
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +17 -0
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +28 -0
- package/dist/cli/registry.d.ts +12 -1
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/pr-checks.d.ts +39 -1
- package/dist/components/pr-checks.d.ts.map +1 -1
- package/dist/components/pr-checks.js +45 -2
- package/dist/components/pr-pipeline.d.ts +11 -3
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +20 -7
- package/dist/components/product-pipeline.d.ts +54 -2
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +63 -6
- package/dist/components/product-plan.d.ts +92 -2
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +172 -22
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +37 -23
- package/dist/lexicon-module.d.ts +2 -0
- package/dist/lexicon-module.d.ts.map +1 -1
- package/dist/lexicon-module.js +6 -2
- package/dist/lexicon.d.ts +82 -4
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gate-applied.d.ts +9 -0
- package/dist/lifecycle/gate-applied.d.ts.map +1 -1
- package/dist/op/apply-status.d.ts +84 -0
- package/dist/op/apply-status.d.ts.map +1 -0
- package/dist/op/apply-status.js +106 -0
- package/dist/op/before-merge-decide.d.ts +102 -0
- package/dist/op/before-merge-decide.d.ts.map +1 -0
- package/dist/op/before-merge-decide.js +142 -0
- package/dist/op/before-merge-done.d.ts +56 -0
- package/dist/op/before-merge-done.d.ts.map +1 -0
- package/dist/op/before-merge-done.js +69 -0
- package/dist/op/before-merge-store.d.ts +20 -0
- package/dist/op/before-merge-store.d.ts.map +1 -0
- package/dist/op/before-merge-store.js +48 -0
- package/dist/op/before-merge.d.ts +150 -0
- package/dist/op/before-merge.d.ts.map +1 -0
- package/dist/op/before-merge.js +207 -0
- package/dist/op/follow-on-run.d.ts +117 -0
- package/dist/op/follow-on-run.d.ts.map +1 -0
- package/dist/op/follow-on-run.js +154 -0
- package/dist/op/follow-on-store.d.ts +17 -0
- package/dist/op/follow-on-store.d.ts.map +1 -0
- package/dist/op/follow-on-store.js +54 -0
- package/dist/op/gate.d.ts +6 -0
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +10 -1
- package/dist/op/index.d.ts +3 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -0
- package/dist/op/op-waves-after-plan.d.ts +13 -0
- package/dist/op/op-waves-after-plan.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.d.ts +4 -1
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.js +10 -2
- package/dist/op/op-waves-follow-on.d.ts +162 -0
- package/dist/op/op-waves-follow-on.d.ts.map +1 -0
- package/dist/op/op-waves-follow-on.js +355 -0
- package/dist/op/op-waves-run.d.ts +146 -6
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +871 -99
- package/dist/op/op-waves-split.d.ts +122 -0
- package/dist/op/op-waves-split.d.ts.map +1 -0
- package/dist/op/op-waves-split.js +166 -0
- package/dist/op/op-waves.d.ts +20 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +15 -1
- package/dist/op/schedule-overdue.d.ts +15 -1
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +18 -2
- package/dist/op/stage-hooks.d.ts +36 -1
- package/dist/op/stage-hooks.d.ts.map +1 -1
- package/dist/op/stage-hooks.js +17 -3
- package/dist/op/wave-stop.d.ts +4 -1
- package/dist/op/wave-stop.d.ts.map +1 -1
- package/dist/op/wave-stop.js +4 -2
- package/dist/planned-files.d.ts +16 -8
- package/dist/planned-files.d.ts.map +1 -1
- package/dist/planned-files.js +12 -8
- package/dist/pr-post.d.ts +6 -0
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +7 -5
- package/dist/release-floors.d.ts +9 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +27 -19
- package/dist/wave-blocked.d.ts +7 -1
- package/dist/wave-blocked.d.ts.map +1 -1
- package/dist/wave-blocked.js +7 -2
- package/dist/wave-runtime.mjs +364 -351
- package/package.json +1 -1
- package/src/actor.test.ts +14 -1
- package/src/actor.ts +8 -6
- package/src/audit/core.ts +13 -1
- package/src/audit/first-load.test.ts +101 -0
- package/src/ci-comment-commands.test.ts +63 -0
- package/src/ci-comment-commands.ts +43 -4
- package/src/ci-image.test.ts +1 -2
- package/src/ci-job-guard.before-merge.test.ts +148 -0
- package/src/ci-job-guard.follow-on-record.test.ts +137 -0
- package/src/ci-job-guard.follow-on.test.ts +144 -0
- package/src/ci-job-guard.ts +221 -3
- package/src/ci-note-commands.test.ts +76 -1
- package/src/ci-note-commands.ts +96 -7
- package/src/ci-product.ts +65 -6
- package/src/cli/handlers/pr-comment.ts +85 -2
- package/src/cli/handlers/pr-notes.ts +30 -6
- package/src/cli/handlers/pr.ts +34 -17
- package/src/cli/handlers/run-wave.ts +144 -4
- package/src/cli/main.ts +17 -0
- package/src/cli/parse-args.ts +20 -0
- package/src/cli/registry.ts +12 -1
- package/src/components/pr-checks.ts +66 -2
- package/src/components/pr-pipeline.ts +21 -9
- package/src/components/product-pipeline.apply-status.test.ts +50 -0
- package/src/components/product-pipeline.ts +117 -9
- package/src/components/product-plan-names.test.ts +135 -0
- package/src/components/product-plan.test.ts +23 -5
- package/src/components/product-plan.ts +248 -25
- package/src/floor-table.data.ts +37 -23
- package/src/lexicon-module.ts +6 -2
- package/src/lexicon.ts +78 -1
- package/src/lifecycle/gate-applied.ts +7 -0
- package/src/op/apply-status.test.ts +83 -0
- package/src/op/apply-status.ts +132 -0
- package/src/op/before-merge-decide.ts +190 -0
- package/src/op/before-merge-done.ts +99 -0
- package/src/op/before-merge-store.ts +44 -0
- package/src/op/before-merge.test.ts +201 -0
- package/src/op/before-merge.ts +266 -0
- package/src/op/follow-on-run.ts +206 -0
- package/src/op/follow-on-store.ts +54 -0
- package/src/op/gate.ts +16 -1
- package/src/op/index.ts +5 -0
- package/src/op/op-waves-after-plan.ts +13 -0
- package/src/op/op-waves-evidence-jobs.ts +11 -3
- package/src/op/op-waves-follow-on-record.test.ts +152 -0
- package/src/op/op-waves-follow-on.test.ts +247 -0
- package/src/op/op-waves-follow-on.ts +385 -0
- package/src/op/op-waves-render-spec.test.ts +1 -2
- package/src/op/op-waves-run.ts +971 -93
- package/src/op/op-waves-split-product.test.ts +288 -0
- package/src/op/op-waves-split-step.test.ts +298 -0
- package/src/op/op-waves-split.test.ts +196 -0
- package/src/op/op-waves-split.ts +189 -0
- package/src/op/op-waves.ts +28 -3
- package/src/op/schedule-overdue.test.ts +29 -1
- package/src/op/schedule-overdue.ts +27 -3
- package/src/op/stage-hooks.ts +52 -4
- package/src/op/wave-stop.ts +5 -3
- package/src/planned-files.test.ts +33 -0
- package/src/planned-files.ts +26 -10
- package/src/pr-post.ts +13 -5
- package/src/release-floors.ts +31 -19
- package/src/wave-blocked.ts +9 -4
package/dist/actor.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const ACTOR_ENV_ORDER: readonly ["GITHUB_ACTOR", "GITLAB_USER_LOG
|
|
|
19
19
|
export declare function actorFromEnv(env?: Record<string, string | undefined>, fallback?: string): string;
|
|
20
20
|
/** Which of the places {@link actorOf} reads, and the answer when none is set. */
|
|
21
21
|
export interface ActorOptions {
|
|
22
|
-
/** The variables. Default `process.env`. */
|
|
22
|
+
/** The variables, and the environment the `git config` for `repo` runs with (#5005). Default `process.env`. */
|
|
23
23
|
env?: Record<string, string | undefined>;
|
|
24
24
|
/** Read `GITHUB_TRIGGERING_ACTOR` first: who re-ran the job, ahead of who started the run. Default false. */
|
|
25
25
|
triggering?: boolean;
|
|
@@ -40,8 +40,10 @@ export declare function actorOrder(options?: Omit<ActorOptions, "env" | "fallbac
|
|
|
40
40
|
* The first place of {@link actorOrder} set to something other than blanks,
|
|
41
41
|
* else `fallback` (#4966). With no options it answers as
|
|
42
42
|
* {@link actorFromEnv}. A git config key is read only when every place
|
|
43
|
-
* before it is empty, so a job with a forge actor runs no git.
|
|
43
|
+
* before it is empty, so a job with a forge actor runs no git. git runs
|
|
44
|
+
* with `env`, so a job's `GIT_CONFIG_GLOBAL` or `HOME` picks the config it
|
|
45
|
+
* reads, not the process's (#5005).
|
|
44
46
|
*/
|
|
45
47
|
export declare function actorOf(options?: ActorOptions): string;
|
|
46
|
-
export { ACTOR_ORDER_FLOOR } from "./release-floors.js";
|
|
48
|
+
export { ACTOR_GIT_ENV_FLOOR, ACTOR_ORDER_FLOOR } from "./release-floors.js";
|
|
47
49
|
//# sourceMappingURL=actor.d.ts.map
|
package/dist/actor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../src/actor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,oFAAoF;AACpF,eAAO,MAAM,eAAe,YAAI,cAAc,EAAE,mBAAmB,EAAE,MAAM,EAAE,UAAU,CAAU,CAAC;AAElG,oHAAoH;AACpH,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EAAE,QAAQ,SAAY,GAAG,MAAM,CAMhH;AAED,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B
|
|
1
|
+
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../src/actor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,oFAAoF;AACpF,eAAO,MAAM,eAAe,YAAI,cAAc,EAAE,mBAAmB,EAAE,MAAM,EAAE,UAAU,CAAU,CAAC;AAElG,oHAAoH;AACpH,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EAAE,QAAQ,SAAY,GAAG,MAAM,CAMhH;AAED,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,+GAA+G;IAC/G,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,6GAA6G;IAC7G,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,sHAAsH;AACtH,wBAAgB,UAAU,CAAC,OAAO,GAAE,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,UAAU,CAAM,GAAG,MAAM,EAAE,CAOzF;AAOD;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,YAAiB,GAAG,MAAM,CAO1D;AAED,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/actor.js
CHANGED
|
@@ -34,23 +34,25 @@ export function actorOrder(options = {}) {
|
|
|
34
34
|
...(options.login === false ? [] : ["USER", "USERNAME"]),
|
|
35
35
|
];
|
|
36
36
|
}
|
|
37
|
-
function gitConfig(repo, key) {
|
|
38
|
-
const r = spawnSync("git", ["-C", repo, "config", key], { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] });
|
|
37
|
+
function gitConfig(repo, key, env) {
|
|
38
|
+
const r = spawnSync("git", ["-C", repo, "config", key], { encoding: "utf-8", env, stdio: ["ignore", "pipe", "ignore"] });
|
|
39
39
|
return r.status === 0 ? r.stdout.trim() : undefined;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* The first place of {@link actorOrder} set to something other than blanks,
|
|
43
43
|
* else `fallback` (#4966). With no options it answers as
|
|
44
44
|
* {@link actorFromEnv}. A git config key is read only when every place
|
|
45
|
-
* before it is empty, so a job with a forge actor runs no git.
|
|
45
|
+
* before it is empty, so a job with a forge actor runs no git. git runs
|
|
46
|
+
* with `env`, so a job's `GIT_CONFIG_GLOBAL` or `HOME` picks the config it
|
|
47
|
+
* reads, not the process's (#5005).
|
|
46
48
|
*/
|
|
47
49
|
export function actorOf(options = {}) {
|
|
48
50
|
const env = options.env ?? process.env;
|
|
49
51
|
for (const place of actorOrder(options)) {
|
|
50
|
-
const v = (place.startsWith("git:") ? gitConfig(options.repo, place.slice(4)) : env[place])?.trim();
|
|
52
|
+
const v = (place.startsWith("git:") ? gitConfig(options.repo, place.slice(4), env) : env[place])?.trim();
|
|
51
53
|
if (v)
|
|
52
54
|
return v;
|
|
53
55
|
}
|
|
54
56
|
return options.fallback ?? "unknown";
|
|
55
57
|
}
|
|
56
|
-
export { ACTOR_ORDER_FLOOR } from "./release-floors.js";
|
|
58
|
+
export { ACTOR_GIT_ENV_FLOOR, ACTOR_ORDER_FLOOR } from "./release-floors.js";
|
package/dist/audit/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/audit/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,oBAAoB,CAAC;AAGhG,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,YAAY,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,KAAK,GACL,QAAQ,GACR,KAAK,GACL,OAAO,GACP,KAAK,GACL,MAAM,GACN,UAAU,GACV,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,iCAAiC;AACjC,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B;;;;;;OAMG;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AM,CAAA;KAAE,CAAC;CAC3C;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AAElF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,kBAAkB,KACvB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAEhE;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;AAa9F;;;;GAIG;AACH,qEAAqE;AACrE,qBAAa,mBAAoB,SAAQ,KAAK;CAAG;AAgFjD;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,UAAU,EAAE,EACpB,IAAI,GAAE;IACJ,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,uHAAuH;IACvH,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B,GACL,OAAO,CAAC,YAAY,EAAE,CAAC,CAqBzB;AAED,8EAA8E;AAC9E,eAAO,MAAM,UAAU,iBAAiB,CAAC"}
|
package/dist/audit/core.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { basename } from "path";
|
|
23
23
|
import { applyInlineSuppressions } from "../lint/suppressions.js";
|
|
24
|
-
import { lexiconModulePath, lexiconPackagesToInstall, lexiconSourceLabel } from "../lexicon-module.js";
|
|
24
|
+
import { isPackageNotFound, lexiconModulePath, lexiconPackagesToInstall, lexiconSourceLabel } from "../lexicon-module.js";
|
|
25
25
|
const checksCache = new Map();
|
|
26
26
|
const entitiesParserCache = new Map();
|
|
27
27
|
function dedupeById(checks) {
|
|
@@ -58,6 +58,16 @@ async function load(names) {
|
|
|
58
58
|
if (pkgs.length === 0) {
|
|
59
59
|
throw new MissingLexiconError(`Could not load the lexicon module ${paths.join(", ")} needed to audit ${names.join("/")} workflows.\n(${detail})`);
|
|
60
60
|
}
|
|
61
|
+
// chant#4881 — only a package that can't be resolved is missing. Any other
|
|
62
|
+
// failure (a module the package imports, its `init()`, a cross-lexicon
|
|
63
|
+
// conflict) is reported as itself, so nobody is told to install a package
|
|
64
|
+
// they have.
|
|
65
|
+
if (paths.length === 0 && !pkgs.some((pkg) => isPackageNotFound(err, pkg))) {
|
|
66
|
+
const generated = /[\\/]generated[\\/]index\b/.test(detail)
|
|
67
|
+
? " Its src/generated/ code is missing; in a source checkout, run the lexicon's `npm run generate`."
|
|
68
|
+
: "";
|
|
69
|
+
throw new Error(`The lexicon package ${pkgs.join(", ")} needed to audit ${names.join("/")} workflows is installed but failed to load: ${detail}${generated}`);
|
|
70
|
+
}
|
|
61
71
|
const fromPath = paths.length > 0 ? ` The lexicon module ${paths.join(", ")} is declared by path and has nothing to install.` : "";
|
|
62
72
|
throw new MissingLexiconError(`Missing lexicon package needed to audit ${names.join("/")} workflows. Install it with: npm i ${pkgs.join(" ")}${fromPath}\n(${detail})`);
|
|
63
73
|
}
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
* the reply says so.
|
|
33
33
|
* - with `noPlanFlags` (#4979), a plan comment with flags the product
|
|
34
34
|
* plan's re-plan cannot take, with the reason.
|
|
35
|
+
* - with `wavesBeforeMerge` (#4984), `/<product> apply [wave-<n>]` on an
|
|
36
|
+
* open pull request: the decision before merge
|
|
37
|
+
* (./op/before-merge-decide.ts) records the head on `chant/lifecycle`
|
|
38
|
+
* and dispatches the waves workflow on the default branch for it.
|
|
35
39
|
*
|
|
36
40
|
* Who asked comes first. On GitHub the commenter's permission is read from
|
|
37
41
|
* the forge; Forgejo answers 403 when a job's token asks for another user's
|
|
@@ -49,6 +53,7 @@ import { type ApplyRerun, type ChantNoteJobs, type StartedRun } from "./ci-note-
|
|
|
49
53
|
import { type CiProductWords, type ParsedProductComment } from "./ci-product-words.js";
|
|
50
54
|
import { type ForgeFetch, type PrForge } from "./pr-forge.js";
|
|
51
55
|
import type { ForgeReads } from "./pr-forge-reads.js";
|
|
56
|
+
import type { DecideBeforeMergeInput, WavesBeforeMergeJobs } from "./op/before-merge-decide.js";
|
|
52
57
|
/** The comment job's name in a generated workflow (#4946). */
|
|
53
58
|
export declare const PR_COMMENT_JOB = "comment";
|
|
54
59
|
/** The variable the comment job reads the pipeline's jobs from, as JSON ({@link CommentJobs}), written by the generator (#4946). */
|
|
@@ -88,7 +93,16 @@ export interface CommentJobs extends Omit<ChantNoteJobs, "members"> {
|
|
|
88
93
|
op: string;
|
|
89
94
|
count: number;
|
|
90
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* The waves before merge (#4984), with `waves`: `/<product> apply
|
|
98
|
+
* [wave-<n>]` on an open pull request is this job's. It decides
|
|
99
|
+
* (./op/before-merge-decide.ts), records the decided head on
|
|
100
|
+
* `chant/lifecycle`, and dispatches the waves workflow for it.
|
|
101
|
+
*/
|
|
102
|
+
wavesBeforeMerge?: WavesBeforeMergeJobs;
|
|
91
103
|
}
|
|
104
|
+
/** What the decision before merge reads and writes with (#4984), the comment job's handler's. */
|
|
105
|
+
export type CommentBeforeMerge = Pick<DecideBeforeMergeInput, "requires" | "statuses" | "git" | "cwd" | "lock" | "record" | "stop" | "now">;
|
|
92
106
|
/** Writes a wave stop for op `op` at `sha` on `chant/lifecycle`, or clears it (#4979). */
|
|
93
107
|
export type CommentWaveStops = (op: string, sha: string, stop: {
|
|
94
108
|
through: number;
|
|
@@ -106,8 +120,8 @@ export declare const RERUN_APPLY_JOBS: RegExp;
|
|
|
106
120
|
export interface CommentRuns {
|
|
107
121
|
/** GitHub: `POST /repos/{repo}/actions/runs/{run}/rerun-failed-jobs`. */
|
|
108
122
|
rerunFailed(run: number): Promise<StartedRun>;
|
|
109
|
-
/** Forgejo: `POST /repos/{repo}/actions/workflows/{workflow}/dispatches` on `ref`. */
|
|
110
|
-
dispatch(workflow: string, ref: string): Promise<StartedRun>;
|
|
123
|
+
/** Forgejo (and before merge, #4984, both): `POST /repos/{repo}/actions/workflows/{workflow}/dispatches` on `ref`, with `inputs`. */
|
|
124
|
+
dispatch(workflow: string, ref: string, inputs?: Record<string, string>): Promise<StartedRun>;
|
|
111
125
|
}
|
|
112
126
|
/** The writes for a GitHub or Forgejo API root, repository and token. */
|
|
113
127
|
export declare function commentRuns(opts: {
|
|
@@ -139,6 +153,8 @@ export interface AnswerCommentOptions {
|
|
|
139
153
|
stops?: CommentWaveStops;
|
|
140
154
|
/** The time a stop is written at. Default now. */
|
|
141
155
|
now?: () => string;
|
|
156
|
+
/** With `jobs.wavesBeforeMerge` (#4984): what the decision reads and writes with. Absent: an open pull request's apply is refused, as before. */
|
|
157
|
+
beforeMerge?: CommentBeforeMerge;
|
|
142
158
|
}
|
|
143
159
|
/** What the comment job did. */
|
|
144
160
|
export interface CommentOutcome {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-comment-commands.d.ts","sourceRoot":"","sources":["../src/ci-comment-commands.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ci-comment-commands.d.ts","sourceRoot":"","sources":["../src/ci-comment-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAGH,OAAO,EAAc,KAAK,UAAU,EAAqB,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACzH,OAAO,EAAuB,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,C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;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,UAAU,CAqBnH"}
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
* the reply says so.
|
|
33
33
|
* - with `noPlanFlags` (#4979), a plan comment with flags the product
|
|
34
34
|
* plan's re-plan cannot take, with the reason.
|
|
35
|
+
* - with `wavesBeforeMerge` (#4984), `/<product> apply [wave-<n>]` on an
|
|
36
|
+
* open pull request: the decision before merge
|
|
37
|
+
* (./op/before-merge-decide.ts) records the head on `chant/lifecycle`
|
|
38
|
+
* and dispatches the waves workflow on the default branch for it.
|
|
35
39
|
*
|
|
36
40
|
* Who asked comes first. On GitHub the commenter's permission is read from
|
|
37
41
|
* the forge; Forgejo answers 403 when a job's token asks for another user's
|
|
@@ -73,7 +77,7 @@ export function commentRuns(opts) {
|
|
|
73
77
|
};
|
|
74
78
|
return {
|
|
75
79
|
rerunFailed: (run) => post(`/actions/runs/${run}/rerun-failed-jobs`, {}),
|
|
76
|
-
dispatch: (workflow, ref) => post(`/actions/workflows/${encodeURIComponent(workflow)}/dispatches`, { ref }),
|
|
80
|
+
dispatch: (workflow, ref, inputs) => post(`/actions/workflows/${encodeURIComponent(workflow)}/dispatches`, { ref, ...(inputs ? { inputs } : {}) }),
|
|
77
81
|
};
|
|
78
82
|
}
|
|
79
83
|
/** Permissions on GitHub that may ask for a command: the same as may push. */
|
|
@@ -202,7 +206,7 @@ export async function answerProductComment(o) {
|
|
|
202
206
|
break;
|
|
203
207
|
}
|
|
204
208
|
// An apply: the apply before merge answers an open pull request; this job a merged one, with applyOnMerge.
|
|
205
|
-
if (!o.jobs.applyBeforeMerge && !o.jobs.applyOnMerge)
|
|
209
|
+
if (!o.jobs.applyBeforeMerge && !o.jobs.applyOnMerge && !o.jobs.wavesBeforeMerge)
|
|
206
210
|
return reply(notRunReply(o.words, "apply", o.forge));
|
|
207
211
|
let pr;
|
|
208
212
|
try {
|
|
@@ -218,6 +222,30 @@ export async function answerProductComment(o) {
|
|
|
218
222
|
if (pr.state === "open") {
|
|
219
223
|
if (o.jobs.applyBeforeMerge)
|
|
220
224
|
return silent("the apply before merge answers this comment", command);
|
|
225
|
+
// #4984: the waves before merge: decide, record the head and dispatch the waves workflow for it.
|
|
226
|
+
const bm = o.jobs.wavesBeforeMerge;
|
|
227
|
+
if (bm && o.jobs.waves && o.beforeMerge) {
|
|
228
|
+
const workflow = bm.workflow;
|
|
229
|
+
if (!workflow)
|
|
230
|
+
return broke("the waves before merge name no workflow to dispatch", command);
|
|
231
|
+
const { decideWavesBeforeMerge } = await import("./op/before-merge-decide.js");
|
|
232
|
+
const done = await decideWavesBeforeMerge({
|
|
233
|
+
...o.beforeMerge,
|
|
234
|
+
forge: o.forge,
|
|
235
|
+
pr,
|
|
236
|
+
user,
|
|
237
|
+
base: o.base,
|
|
238
|
+
...(parsed.wave !== undefined ? { wave: parsed.wave } : {}),
|
|
239
|
+
op: o.jobs.waves.op,
|
|
240
|
+
count: o.jobs.waves.count,
|
|
241
|
+
jobs: bm,
|
|
242
|
+
words: o.words,
|
|
243
|
+
start: (r) => o.runs.dispatch(workflow, o.base, { pr: String(r.pr), head: r.head, digest: r.digest }),
|
|
244
|
+
});
|
|
245
|
+
if (done.kind === "fail")
|
|
246
|
+
return broke(done.reason, command);
|
|
247
|
+
return reply(done.text, done.kind === "ran", done.kind === "ran" ? done.url : undefined);
|
|
248
|
+
}
|
|
221
249
|
return reply(`${at} is not merged: \`/${o.words.product} ${typedApply(o.words)}\` runs the ${verb[0]} of a merged ${t.request} again, from the default branch, and never ${verb[0]}s a ${t.request}'s branch`);
|
|
222
250
|
}
|
|
223
251
|
if (pr.state === "closed")
|
package/dist/ci-job-guard.d.ts
CHANGED
|
@@ -1,48 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The apply-job guard (#4624): the first step of each op-wave job checks
|
|
3
|
-
* that the job runs where the spec set it to run, and stops it otherwise,
|
|
4
|
-
* before any token is traded and before the checkout.
|
|
5
|
-
*
|
|
6
|
-
* What the job is expected to see is written into the job when the pipeline
|
|
7
|
-
* is rendered, as JSON in {@link JOB_GUARD_ENV}: the guard reads no file of
|
|
8
|
-
* the commit it runs on. What it sees comes from the forge:
|
|
9
|
-
*
|
|
10
|
-
* forge environment GitHub: the `environment` claim of an OIDC token the
|
|
11
|
-
* guard requests for its own audience
|
|
12
|
-
* ({@link JOB_GUARD_AUDIENCE}), decodes and drops. GitHub
|
|
13
|
-
* sets no variable with the job's environment, so a job
|
|
14
|
-
* that may request no token is not checked for it.
|
|
15
|
-
* GitLab: CI_ENVIRONMENT_NAME. Forgejo has no
|
|
16
|
-
* environments: not checked.
|
|
17
|
-
* ref GitHub and Forgejo: GITHUB_REF is refs/heads/<branch>
|
|
18
|
-
* for one of the branches the waves apply from. GitLab:
|
|
19
|
-
* CI_COMMIT_REF_NAME is one of them, and
|
|
20
|
-
* CI_COMMIT_REF_PROTECTED is "true".
|
|
21
|
-
* runner GitLab: CI_RUNNER_TAGS holds each of the job's tags.
|
|
22
|
-
* GitHub and Forgejo expose no labels, only whether the
|
|
23
|
-
* runner is self-hosted: when the job's labels include
|
|
24
|
-
* `self-hosted`, the token's runner_environment claim,
|
|
25
|
-
* else RUNNER_ENVIRONMENT, is `self-hosted`. Neither
|
|
26
|
-
* set: not checked.
|
|
27
|
-
*
|
|
28
|
-
* The generated step runs {@link jobGuardLine}: `node -e` from `/`, as the
|
|
29
|
-
* cloud trade does, so no file of the checkout is in reach and the guard
|
|
30
|
-
* needs nothing installed. `chant ci check-job` (and so a product's bin,
|
|
31
|
-
* `plywood ci check-job`, `terragucci ci check-job`) runs the same check
|
|
32
|
-
* from the same variable, through {@link checkJob}, for a product that
|
|
33
|
-
* renders its own jobs. The lines name the product from its words.
|
|
34
|
-
*
|
|
35
|
-
* A refusal exits chant's `misplaced` (9), as does a variable the guard
|
|
36
|
-
* cannot read. GitLab's op-wave jobs allow exit 1 as a failure the next wave
|
|
37
|
-
* runs after, and 9 is outside that set, so a refused job fails and the
|
|
38
|
-
* waves after it stop.
|
|
39
|
-
*
|
|
40
|
-
* The guard catches a hand edit, a dropped `environment:` or a mistyped
|
|
41
|
-
* label. Someone who can edit the workflow can delete it too: the forge's
|
|
42
|
-
* environment and runner settings and the cloud role's trust are what keep
|
|
43
|
-
* a job out.
|
|
44
|
-
*/
|
|
45
1
|
import { type CiRunner } from "./ci-jobs.js";
|
|
2
|
+
import { type BeforeMergeRecord, type BeforeMergeRun } from "./op/before-merge.js";
|
|
3
|
+
import { type FollowOnRecord, type FollowOnRun } from "./op/follow-on-run.js";
|
|
46
4
|
/** The variable the generated step carries its expectation in. */
|
|
47
5
|
export declare const JOB_GUARD_ENV = "CHANT_JOB_GUARD";
|
|
48
6
|
/** The audience of the token the guard requests on GitHub, which no cloud role should trust. */
|
|
@@ -63,6 +21,12 @@ export interface JobGuardSpec {
|
|
|
63
21
|
runnerTags?: string[];
|
|
64
22
|
/** GitHub and Forgejo: the runner must be self-hosted. */
|
|
65
23
|
selfHosted?: boolean;
|
|
24
|
+
/** The waves have a before-merge mode (#4984): a run that names a head runs only as op `op`'s recorded decision. */
|
|
25
|
+
beforeMerge?: {
|
|
26
|
+
op: string;
|
|
27
|
+
};
|
|
28
|
+
/** The job is one of the `rest` wave's (#4992), rendered as this wave: a follow-on run may name a later one. */
|
|
29
|
+
rest?: number;
|
|
66
30
|
}
|
|
67
31
|
/** What the job sees. Undefined: the forge did not say. */
|
|
68
32
|
export interface JobSeen {
|
|
@@ -74,6 +38,18 @@ export interface JobSeen {
|
|
|
74
38
|
refProtected?: string;
|
|
75
39
|
runnerTags?: string[];
|
|
76
40
|
runnerEnvironment?: string;
|
|
41
|
+
/** The decision the run names (#4984), from its variables. */
|
|
42
|
+
beforeMerge?: BeforeMergeRun;
|
|
43
|
+
/** The recorded decision for that head; null when there is none. Read only when the spec has a before-merge mode. */
|
|
44
|
+
beforeMergeRecord?: BeforeMergeRecord | null;
|
|
45
|
+
/** Why the decisions could not be read, when they could not. */
|
|
46
|
+
beforeMergeError?: string;
|
|
47
|
+
/** The follow-on variables the run names (#4992). */
|
|
48
|
+
followOn?: FollowOnRun;
|
|
49
|
+
/** The follow-on record of the run's chain (#4998); null when there is none. Read only for a follow-on the rest wave's job would admit. */
|
|
50
|
+
followOnRecord?: FollowOnRecord | null;
|
|
51
|
+
/** Why the follow-on records could not be read, when they could not. */
|
|
52
|
+
followOnError?: string;
|
|
77
53
|
}
|
|
78
54
|
export interface JobGuardResult {
|
|
79
55
|
/** One line per value that does not match, naming the expected and found values. */
|
|
@@ -96,6 +72,12 @@ export interface JobGuardInput {
|
|
|
96
72
|
runner?: CiRunner;
|
|
97
73
|
/** GitHub: the job may request an OIDC token (`id-token: write`), so the guard can read its environment. */
|
|
98
74
|
idToken?: boolean;
|
|
75
|
+
/** The waves' before-merge mode (#4984), with the op its decisions are recorded under. */
|
|
76
|
+
beforeMerge?: {
|
|
77
|
+
op: string;
|
|
78
|
+
};
|
|
79
|
+
/** The job is one of the `rest` wave's (#4992), whose number this is. */
|
|
80
|
+
rest?: number;
|
|
99
81
|
}
|
|
100
82
|
/**
|
|
101
83
|
* The expectation a generator writes into a job. GitHub checks the forge
|
|
@@ -111,7 +93,22 @@ export declare function tokenClaims(token: string): Record<string, unknown>;
|
|
|
111
93
|
/** Compare what the job sees with what the spec expects. */
|
|
112
94
|
export declare function checkJob(expect: JobGuardSpec, seen: JobSeen): JobGuardResult;
|
|
113
95
|
/** What the job sees, from the forge's variables, and on GitHub from its token's claims when the forge environment is to be checked. */
|
|
114
|
-
export declare function jobSeen(expect: JobGuardSpec, env?: NodeJS.ProcessEnv, fetchFn?: typeof fetch): Promise<JobSeen>;
|
|
96
|
+
export declare function jobSeen(expect: JobGuardSpec, env?: NodeJS.ProcessEnv, fetchFn?: typeof fetch, readLifecycle?: LifecycleFileReader): Promise<JobSeen>;
|
|
97
|
+
/** Reads one file of `chant/lifecycle` as the remote has it; null when the branch has no such file (#4984). */
|
|
98
|
+
export type LifecycleFileReader = (forge: JobGuardForge, env: NodeJS.ProcessEnv, path: string) => string | null;
|
|
99
|
+
/** The repository's git URL and the job token's basic credentials, as the guard fetches with them (#4984). */
|
|
100
|
+
export declare function guardRemote(forge: JobGuardForge, env: NodeJS.ProcessEnv): {
|
|
101
|
+
url: string;
|
|
102
|
+
user: string;
|
|
103
|
+
token: string;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* {@link LifecycleFileReader} through git: `chant/lifecycle` fetched at depth
|
|
107
|
+
* one into a directory of the guard's own, outside the checkout, with the
|
|
108
|
+
* token as a basic credential header, and the file shown from it. The
|
|
109
|
+
* `node -e` program does the same.
|
|
110
|
+
*/
|
|
111
|
+
export declare const lifecycleFileByGit: LifecycleFileReader;
|
|
115
112
|
/** The lines the guard prints, and whether the job may go on. */
|
|
116
113
|
export declare function describeJobGuard(expect: JobGuardSpec, result: JobGuardResult): {
|
|
117
114
|
ok: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-job-guard.d.ts","sourceRoot":"","sources":["../src/ci-job-guard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ci-job-guard.d.ts","sourceRoot":"","sources":["../src/ci-job-guard.ts"],"names":[],"mappings":"AA0EA,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAwK,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtP,OAAO,EAAqI,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE9M,kEAAkE;AAClE,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C,gGAAgG;AAChG,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,C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