@r_masseater/fu4 0.3.8 → 0.4.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/README.md +7 -6
- package/dist/{app-BkrdDFcT.mjs → app-aXU9Rkpj.mjs} +2 -2
- package/dist/{app-BkrdDFcT.mjs.map → app-aXU9Rkpj.mjs.map} +1 -1
- package/dist/{cli-D8rNwfcW.mjs → cli-DJq7rcJu.mjs} +3 -3
- package/dist/{cli-D8rNwfcW.mjs.map → cli-DJq7rcJu.mjs.map} +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/define-Dvnt_9zv.mjs +6 -0
- package/dist/define-Dvnt_9zv.mjs.map +1 -0
- package/dist/{index-DM3Q3-YV.d.mts → index-BJIbqoE-.d.mts} +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +3 -2
- package/dist/presets.d.mts +2 -1
- package/dist/presets.mjs +464 -2000
- package/dist/presets.mjs.map +1 -1
- package/dist/rules.d.mts +295 -0
- package/dist/rules.mjs +1 -0
- package/dist/{source-CLFOyvUG.mjs → source-Cnghop8O.mjs} +2 -5
- package/dist/source-Cnghop8O.mjs.map +1 -0
- package/dist/vite.d.mts +1 -1
- package/dist/workflow-rule-C1TJLS9H.mjs +1592 -0
- package/dist/workflow-rule-C1TJLS9H.mjs.map +1 -0
- package/package.json +8 -4
- package/skills/apply-fu4-presets/SKILL.md +6 -2
- package/skills/lint-workflows/SKILL.md +6 -0
- package/dist/source-CLFOyvUG.mjs.map +0 -1
package/dist/presets.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as defineRule, t as definePlugin } from "./define-Dvnt_9zv.mjs";
|
|
2
|
+
import { a as afterPrefix, i as INPUT_KINDS, o as baseName, t as lineStartsOf } from "./source-Cnghop8O.mjs";
|
|
3
|
+
import { C as sortedQuotes, S as quotes, T as parseGoFloat, _ as valueAt, a as ancestorsBy, b as quote, c as actionOf, d as isNull, f as isQuoted$1, h as readYaml, i as workflowOf, l as runOf, m as pairsOf, n as eachEvent, o as containsExpression, p as keysOf, r as workflowRule, s as isExpressionAssigned, t as NOOP, u as describePosition, v as codePoints, w as atoi, x as quoteChar, y as ordinal } from "./workflow-rule-C1TJLS9H.mjs";
|
|
2
4
|
import { Array as Array$1, Boolean as Boolean$1, Cache, Config, DateTime, Deferred, Effect, Equal, FileSystem, Function, Layer, ManagedRuntime, Match, Option, Order, Path, Predicate, Record, Redacted, Result, Schema, String as String$1, identity, pipe } from "effect";
|
|
3
5
|
import { layer } from "@effect/platform-node/NodeServices";
|
|
4
6
|
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
|
|
@@ -7,7 +9,7 @@ const taggedError$1 = Schema.TaggedError;
|
|
|
7
9
|
var GitHubError = class extends taggedError$1()("GitHubError", { message: Schema.String }) {};
|
|
8
10
|
// src/app/presets/shared/git-protocol/pkt-line.ts
|
|
9
11
|
const PREFIX$1 = 4;
|
|
10
|
-
const HEX$
|
|
12
|
+
const HEX$3 = 16;
|
|
11
13
|
const FLUSH = 0;
|
|
12
14
|
const DELIM = 1;
|
|
13
15
|
const SMALLEST_DATA = 5;
|
|
@@ -16,7 +18,7 @@ const ERROR = "ERR ";
|
|
|
16
18
|
const LENGTH = /^[0-9a-f]{4}$/iu;
|
|
17
19
|
const encoder$2 = new TextEncoder();
|
|
18
20
|
const decoder$1 = new TextDecoder();
|
|
19
|
-
const hexLength = (length) => String$1.padStart(PREFIX$1, "0")(length.toString(HEX$
|
|
21
|
+
const hexLength = (length) => String$1.padStart(PREFIX$1, "0")(length.toString(HEX$3));
|
|
20
22
|
const encodeOne = Match.type().pipe(Match.discriminatorsExhaustive("type")({
|
|
21
23
|
data: ({ data }) => `${hexLength(encoder$2.encode(data).length + PREFIX$1)}${data}`,
|
|
22
24
|
flush: () => "0000",
|
|
@@ -26,7 +28,7 @@ const encodePackets = (packets) => encoder$2.encode(pipe(packets, Array$1.map(en
|
|
|
26
28
|
const lengthAt = (bytes) => (position) => {
|
|
27
29
|
const text = decoder$1.decode(bytes.subarray(position, position + PREFIX$1));
|
|
28
30
|
if (!LENGTH.test(text)) return Result.fail(`invalid packet line length: ${text}`);
|
|
29
|
-
return Result.succeed(Number.parseInt(text, HEX$
|
|
31
|
+
return Result.succeed(Number.parseInt(text, HEX$3));
|
|
30
32
|
};
|
|
31
33
|
const dataAt = (bytes, position) => (length) => {
|
|
32
34
|
const end = position + length;
|
|
@@ -145,7 +147,7 @@ const refsOf = (refs) => ({
|
|
|
145
147
|
branches: named$1(HEADS)(refs),
|
|
146
148
|
tags: tagsOf(refs)
|
|
147
149
|
});
|
|
148
|
-
const parsed$
|
|
150
|
+
const parsed$2 = (url) => (reply) => {
|
|
149
151
|
if (reply.status === 404) return Effect.succeedNone;
|
|
150
152
|
if (!isOk(reply)) return Effect.fail(unexpected$3(url)(reply));
|
|
151
153
|
return Result.match(parseLsRefs(reply.bytes), {
|
|
@@ -170,7 +172,7 @@ const upload = (session, url) => (headers) => session.transport({
|
|
|
170
172
|
const listRefs = (session) => (slug) => {
|
|
171
173
|
const url = `${session.endpoints.web}/${slug}.git/git-upload-pack`;
|
|
172
174
|
const send = upload(session, url);
|
|
173
|
-
return send({ Authorization: basic(session.token) }).pipe(Effect.filterOrElse((reply) => reply.status !== UNAUTHORIZED, () => send({})), Effect.flatMap(parsed$
|
|
175
|
+
return send({ Authorization: basic(session.token) }).pipe(Effect.filterOrElse((reply) => reply.status !== UNAUTHORIZED, () => send({})), Effect.flatMap(parsed$2(url)));
|
|
174
176
|
};
|
|
175
177
|
// src/app/presets/features/audit-workflows/api/client.ts
|
|
176
178
|
const CAPACITY = Number.MAX_SAFE_INTEGER;
|
|
@@ -350,7 +352,7 @@ const started = Effect.fn("fu4.github.start")(function* started(host, root, toke
|
|
|
350
352
|
});
|
|
351
353
|
const startClient = ({ host, root, token }) => platform.contextEffect.pipe(Effect.flatMap((context) => Effect.provideContext(started(host, root, token), context)));
|
|
352
354
|
// src/app/presets/features/audit-workflows/api/session.ts
|
|
353
|
-
const SEPARATOR$
|
|
355
|
+
const SEPARATOR$1 = "\0";
|
|
354
356
|
const TOKEN = Config.Redacted("ZIZMOR_GITHUB_TOKEN").pipe(Config.orElse(() => Config.Redacted("GH_TOKEN")), Config.orElse(() => Config.Redacted("GITHUB_TOKEN")), Config.option);
|
|
355
357
|
const clients = /* @__PURE__ */ new Map();
|
|
356
358
|
const fresh = (key, start) => {
|
|
@@ -363,7 +365,7 @@ const clientFor = (host, root) => (token) => {
|
|
|
363
365
|
root,
|
|
364
366
|
host,
|
|
365
367
|
Redacted.value(token)
|
|
366
|
-
], Array$1.join(SEPARATOR$
|
|
368
|
+
], Array$1.join(SEPARATOR$1));
|
|
367
369
|
return Option.match(Option.fromNullishOr(clients.get(key)), {
|
|
368
370
|
onSome: Deferred.await,
|
|
369
371
|
onNone: () => fresh(key, startClient({
|
|
@@ -388,106 +390,6 @@ const characterColumnOf = (text) => (offset) => {
|
|
|
388
390
|
});
|
|
389
391
|
return Array$1.fromIterable(String$1.slice(lineStart)(before)).length;
|
|
390
392
|
};
|
|
391
|
-
// src/app/presets/shared/text/number.ts
|
|
392
|
-
const ZERO$3 = 0;
|
|
393
|
-
const EXPONENT_ABOVE = 1e21;
|
|
394
|
-
const EXPONENT_BELOW = 1e-4;
|
|
395
|
-
const SIGNS = /^[+-]*/u;
|
|
396
|
-
const FLOAT_CHARS = /^[\d.eE+-]+$/u;
|
|
397
|
-
const INFINITE = /* @__PURE__ */ new Set(["inf", "infinity"]);
|
|
398
|
-
const DIGITS$4 = /^[+-]?\d+$/u;
|
|
399
|
-
const MAX_SIGNS = 1;
|
|
400
|
-
const INT64_MIN = BigInt("-9223372036854775808");
|
|
401
|
-
const INT64_MAX = 9223372036854775807n;
|
|
402
|
-
const nonFinite = (value) => {
|
|
403
|
-
if (Number.isNaN(value)) return "NaN";
|
|
404
|
-
if (value < ZERO$3) return "-inf";
|
|
405
|
-
return "inf";
|
|
406
|
-
};
|
|
407
|
-
const goFloat = (value) => {
|
|
408
|
-
if (!Number.isFinite(value)) return nonFinite(value);
|
|
409
|
-
if (Number.isInteger(value) && Math.abs(value) < EXPONENT_ABOVE) return value.toFixed(ZERO$3);
|
|
410
|
-
if (Math.abs(value) >= EXPONENT_ABOVE || value !== ZERO$3 && Math.abs(value) < EXPONENT_BELOW) return value.toExponential();
|
|
411
|
-
return String(value);
|
|
412
|
-
};
|
|
413
|
-
const infinite = (text) => {
|
|
414
|
-
if (String$1.startsWith("-")(text)) return Number.NEGATIVE_INFINITY;
|
|
415
|
-
return Number.POSITIVE_INFINITY;
|
|
416
|
-
};
|
|
417
|
-
const special = (text) => {
|
|
418
|
-
const lower = pipe(text, String$1.replace(SIGNS, ""), String$1.toLowerCase);
|
|
419
|
-
if (INFINITE.has(lower)) return Option.some(infinite(text));
|
|
420
|
-
if (lower === "nan") return Option.some(NaN);
|
|
421
|
-
return Option.none();
|
|
422
|
-
};
|
|
423
|
-
const plainFloat = (text) => {
|
|
424
|
-
const body = String$1.replace(SIGNS, "")(text);
|
|
425
|
-
const hex = pipe(body, String$1.toLowerCase, String$1.startsWith("0x"));
|
|
426
|
-
if (text.length - body.length > MAX_SIGNS || String$1.includes("_")(text) || hex || !FLOAT_CHARS.test(body)) return Option.none();
|
|
427
|
-
return Option.liftPredicate(Number(text), (value) => !Number.isNaN(value));
|
|
428
|
-
};
|
|
429
|
-
const parseGoFloat = (text) => Option.orElse(special(text), () => plainFloat(text));
|
|
430
|
-
const atoi = (text) => {
|
|
431
|
-
if (!DIGITS$4.test(text)) return "invalid syntax";
|
|
432
|
-
const value = BigInt(text);
|
|
433
|
-
if (value < INT64_MIN || value > INT64_MAX) return "value out of range";
|
|
434
|
-
return Number(value);
|
|
435
|
-
};
|
|
436
|
-
// src/app/presets/shared/text/quote.ts
|
|
437
|
-
const ESCAPES$2 = {
|
|
438
|
-
"\x07": String.raw`\a`,
|
|
439
|
-
"\b": String.raw`\b`,
|
|
440
|
-
"\f": String.raw`\f`,
|
|
441
|
-
"\n": String.raw`\n`,
|
|
442
|
-
"\r": String.raw`\r`,
|
|
443
|
-
" ": String.raw`\t`,
|
|
444
|
-
"\v": String.raw`\v`,
|
|
445
|
-
"\\": String.raw`\\`
|
|
446
|
-
};
|
|
447
|
-
const ASCII_END = 128;
|
|
448
|
-
const BMP_END = 65536;
|
|
449
|
-
const BYTE_DIGITS = 2;
|
|
450
|
-
const SHORT_DIGITS = 4;
|
|
451
|
-
const LONG_DIGITS = 8;
|
|
452
|
-
const HEX$3 = 16;
|
|
453
|
-
const FIRST$8 = 0;
|
|
454
|
-
const UNPRINTABLE = /[\p{Cc}\p{Z}\uFEFF\uFFF9-\uFFFB\uE000-\uF8FF\u2028\u2029]/u;
|
|
455
|
-
const SPACE = " ";
|
|
456
|
-
const SEPARATOR$1 = ", ";
|
|
457
|
-
const hex = (code, digits) => String$1.padStart(digits, "0")(code.toString(HEX$3));
|
|
458
|
-
const unicodeEscape = (code) => {
|
|
459
|
-
if (code < ASCII_END) return `\\x${hex(code, BYTE_DIGITS)}`;
|
|
460
|
-
if (code < BMP_END) return `\\u${hex(code, SHORT_DIGITS)}`;
|
|
461
|
-
return `\\U${hex(code, LONG_DIGITS)}`;
|
|
462
|
-
};
|
|
463
|
-
const escapeChar = (delimiter) => (character) => Option.getOrElse(Record.get(ESCAPES$2, character), () => {
|
|
464
|
-
if (character === delimiter) return `\\${character}`;
|
|
465
|
-
if (character !== SPACE && UNPRINTABLE.test(character)) return unicodeEscape(Option.getOrElse(String$1.codePointAt(FIRST$8)(character), () => FIRST$8));
|
|
466
|
-
return character;
|
|
467
|
-
});
|
|
468
|
-
const codePoints = (text) => {
|
|
469
|
-
const points = [];
|
|
470
|
-
for (const point of text) points.push(point);
|
|
471
|
-
return points;
|
|
472
|
-
};
|
|
473
|
-
const escaped$3 = (text, delimiter) => pipe(codePoints(text), Array$1.map(escapeChar(delimiter)), Array$1.join(""));
|
|
474
|
-
const quote = (text) => `"${escaped$3(text, "\"")}"`;
|
|
475
|
-
const quoteChar = (character) => `'${escaped$3(character, "'")}'`;
|
|
476
|
-
const quotes = (items) => pipe(items, Array$1.map(quote), Array$1.join(SEPARATOR$1));
|
|
477
|
-
const sortedQuotes = (items) => quotes(Array$1.sort(items, Order.String));
|
|
478
|
-
const TEEN_START = 11;
|
|
479
|
-
const TEEN_END = 13;
|
|
480
|
-
const TEN = 10;
|
|
481
|
-
const HUNDRED = 100;
|
|
482
|
-
const SUFFIXES = {
|
|
483
|
-
1: "st",
|
|
484
|
-
2: "nd",
|
|
485
|
-
3: "rd"
|
|
486
|
-
};
|
|
487
|
-
const ordinal = (value) => {
|
|
488
|
-
if (value % HUNDRED >= TEEN_START && value % HUNDRED <= TEEN_END) return `${String(value)}th`;
|
|
489
|
-
return `${String(value)}${Option.getOrElse(Record.get(SUFFIXES, String(value % TEN)), () => "th")}`;
|
|
490
|
-
};
|
|
491
393
|
// src/app/presets/shared/subfeature/index.ts
|
|
492
394
|
const WHITESPACE$2 = /\s/u;
|
|
493
395
|
const RUNS = /\s+/gu;
|
|
@@ -544,7 +446,7 @@ const isMapping = (node) => MAPPINGS.has(node.type);
|
|
|
544
446
|
const isSequence = (node) => SEQUENCES.has(node.type);
|
|
545
447
|
const isPair = (node) => PAIRS$1.has(node.type);
|
|
546
448
|
const isContainer = (node) => CONTAINERS.has(node.type);
|
|
547
|
-
const isQuoted
|
|
449
|
+
const isQuoted = (node) => QUOTED.has(node.type);
|
|
548
450
|
const isAnchor = (node) => node.type === "anchor";
|
|
549
451
|
const isAlias = (node) => node.type === "alias";
|
|
550
452
|
const isComment = (node) => node.type === "comment";
|
|
@@ -619,12 +521,12 @@ const featureComments = (document) => (node) => trawl(document, spanOf$1(documen
|
|
|
619
521
|
// src/app/presets/shared/yamlpath/query.ts
|
|
620
522
|
const QUOTE_WIDTH$1 = 1;
|
|
621
523
|
const NAME_START = 1;
|
|
622
|
-
const FIRST$
|
|
524
|
+
const FIRST$6 = 0;
|
|
623
525
|
const resolved$1 = (document, alias, at) => Result.fromOption(resolveAnchor(document)(String$1.slice(NAME_START)(alias.text), at), () => `unknown alias: ${alias.text}`);
|
|
624
526
|
const keyText = (key) => Option.match(namedWhere((child) => !isAnchor(child))(key), {
|
|
625
527
|
onNone: () => key.text,
|
|
626
528
|
onSome: (scalar) => {
|
|
627
|
-
if (isQuoted
|
|
529
|
+
if (isQuoted(scalar)) return String$1.slice(QUOTE_WIDTH$1, scalar.text.length - QUOTE_WIDTH$1)(scalar.text);
|
|
628
530
|
return scalar.text;
|
|
629
531
|
}
|
|
630
532
|
});
|
|
@@ -665,7 +567,7 @@ const walk$2 = (document) => (route) => {
|
|
|
665
567
|
return focus;
|
|
666
568
|
};
|
|
667
569
|
const resolveTarget = (document) => (node) => {
|
|
668
|
-
const first = childAt(FIRST$
|
|
570
|
+
const first = childAt(FIRST$6)(node);
|
|
669
571
|
if (Option.exists(first, isAlias)) return resolved$1(document, Option.getOrThrow(first), Option.getOrThrow(first).start);
|
|
670
572
|
if (Option.exists(first, isAnchor)) return Result.succeed(Option.getOrElse(namedWhere((each) => !isAnchor(each))(node), () => node));
|
|
671
573
|
return Result.succeed(node);
|
|
@@ -854,7 +756,7 @@ const atRaw = (location) => (draft) => ({
|
|
|
854
756
|
...draft,
|
|
855
757
|
rawLocations: [...draft.rawLocations, location]
|
|
856
758
|
});
|
|
857
|
-
const SINGLE$
|
|
759
|
+
const SINGLE$20 = 1;
|
|
858
760
|
const asPrimary = (only) => ({
|
|
859
761
|
...only,
|
|
860
762
|
symbolic: {
|
|
@@ -868,7 +770,7 @@ const finished$1 = (draft) => (locations) => ({
|
|
|
868
770
|
ignored: pipe(locations, Array$1.flatMap((each) => each.concrete.comments), Array$1.some(commentIgnores(draft.ident)))
|
|
869
771
|
});
|
|
870
772
|
const withPrimary = (locations) => {
|
|
871
|
-
if (locations.length === SINGLE$
|
|
773
|
+
if (locations.length === SINGLE$20) return Result.succeed(pipe(locations, Array$1.map(asPrimary)));
|
|
872
774
|
if (!pipe(locations, Array$1.some((each) => each.symbolic.kind === "primary"))) return Result.fail("API misuse: at least one location must be marked with primary()");
|
|
873
775
|
return Result.succeed(locations);
|
|
874
776
|
};
|
|
@@ -886,32 +788,6 @@ const message = (found) => {
|
|
|
886
788
|
})} (${Option.getOrElse(location.symbolic.link, () => found.url)})`;
|
|
887
789
|
};
|
|
888
790
|
const primaryColumn = (text) => (found) => characterColumnOf(text)(primaryLocation(found).concrete.startOffset);
|
|
889
|
-
// src/app/presets/shared/yaml/node.ts
|
|
890
|
-
const PAIR$8 = 2;
|
|
891
|
-
const KEY$1 = 0;
|
|
892
|
-
const VALUE$1 = 1;
|
|
893
|
-
const isQuoted = (node) => node.style === "single-quoted" || node.style === "double-quoted";
|
|
894
|
-
const isNull = (node) => node.kind === "scalar" && node.tag === "!!null";
|
|
895
|
-
const pairsOf = (node) => {
|
|
896
|
-
if (node.kind !== "mapping") return [];
|
|
897
|
-
return pipe(Array$1.chunksOf(node.children, PAIR$8), Array$1.flatMap((chunk) => pipe(Option.all([Array$1.get(chunk, KEY$1), Array$1.get(chunk, VALUE$1)]), Option.map(([key, value]) => ({
|
|
898
|
-
key,
|
|
899
|
-
value
|
|
900
|
-
})), Option.toArray)));
|
|
901
|
-
};
|
|
902
|
-
const keysOf = (node) => pipe(pairsOf(node), Array$1.map((pair) => pair.key.value));
|
|
903
|
-
const valueAt = (key) => (node) => pipe(pairsOf(node), Array$1.findFirst((pair) => pair.key.value === key), Option.map((pair) => pair.value));
|
|
904
|
-
const textOf$2 = (node) => ({
|
|
905
|
-
value: node.value,
|
|
906
|
-
quoted: isQuoted(node),
|
|
907
|
-
line: node.line,
|
|
908
|
-
column: node.column
|
|
909
|
-
});
|
|
910
|
-
const describePosition = (position) => `line:${String(position.line)},col:${String(position.column)}`;
|
|
911
|
-
const readYaml = (read) => (source) => pipe(Array$1.head(source.errors), Option.match({
|
|
912
|
-
onNone: () => read(source),
|
|
913
|
-
onSome: (error) => Result.fail(`yaml: line ${String(error.line)}: ${error.message}`)
|
|
914
|
-
}));
|
|
915
791
|
// src/app/presets/shared/yaml/decoder.ts
|
|
916
792
|
const SHOWN = 10;
|
|
917
793
|
const TRUE$1 = /* @__PURE__ */ new Set([
|
|
@@ -973,7 +849,7 @@ const decodeOptionalString = (sink) => (node) => pipe(Option.liftPredicate(node,
|
|
|
973
849
|
const scalarBoolean = (node) => {
|
|
974
850
|
if (isNull(node)) return Option.some(false);
|
|
975
851
|
if (node.tag === "!!bool") return Option.some(TRUE_TAGGED.has(node.value));
|
|
976
|
-
if (isQuoted(node)) return Option.none();
|
|
852
|
+
if (isQuoted$1(node)) return Option.none();
|
|
977
853
|
if (TRUE$1.has(node.value)) return Option.some(true);
|
|
978
854
|
return Option.liftPredicate(false, () => FALSE$1.has(node.value));
|
|
979
855
|
};
|
|
@@ -1036,11 +912,11 @@ const fieldsOf$4 = (node) => Result.flatMap(entriesOf(node), (entries) => {
|
|
|
1036
912
|
});
|
|
1037
913
|
});
|
|
1038
914
|
const nodeAt = (fields) => (name) => Option.fromNullishOr(fields.entries.get(name));
|
|
1039
|
-
const required
|
|
915
|
+
const required = (name) => (decoder) => (fields) => Option.match(nodeAt(fields)(name), {
|
|
1040
916
|
onNone: () => Result.fail(`missing field \`${name}\``),
|
|
1041
917
|
onSome: decoder
|
|
1042
918
|
});
|
|
1043
|
-
const optional
|
|
919
|
+
const optional = (name) => (decoder) => (fields) => Option.match(pipe(nodeAt(fields)(name), Option.filter((node) => !isNull(node))), {
|
|
1044
920
|
onNone: () => Result.succeed(Option.none()),
|
|
1045
921
|
onSome: (node) => Result.map(decoder(node), Option.some)
|
|
1046
922
|
});
|
|
@@ -1053,8 +929,8 @@ const scalarOrVector = (item) => untagged((node) => Result.map(item(node), Array
|
|
|
1053
929
|
const map = (decoder) => (transform) => (node) => Result.map(decoder(node), transform);
|
|
1054
930
|
const struct = (build) => (node) => Result.flatMap(fieldsOf$4(node), build);
|
|
1055
931
|
// src/app/presets/features/audit-workflows/lib/common.ts
|
|
1056
|
-
const OPEN$
|
|
1057
|
-
const CLOSE$
|
|
932
|
+
const OPEN$4 = "${{";
|
|
933
|
+
const CLOSE$3 = "}}";
|
|
1058
934
|
const SLUG_PARTS = 3;
|
|
1059
935
|
const OWNER_REPO = 2;
|
|
1060
936
|
const NEXT$19 = 1;
|
|
@@ -1065,7 +941,7 @@ const PERMISSION_LEVELS = record(literal$1([
|
|
|
1065
941
|
"write",
|
|
1066
942
|
"none"
|
|
1067
943
|
]));
|
|
1068
|
-
const isFenced = (raw) => String$1.startsWith(OPEN$
|
|
944
|
+
const isFenced = (raw) => String$1.startsWith(OPEN$4)(raw) && String$1.endsWith(CLOSE$3)(raw);
|
|
1069
945
|
const loe = (inner) => (node) => {
|
|
1070
946
|
const expr = Result.flatMap(string$1(node), (raw) => Result.liftPredicate(raw, isFenced, () => "not an expression"));
|
|
1071
947
|
if (Result.isSuccess(expr)) return Result.succeed({
|
|
@@ -1194,9 +1070,9 @@ const reusableUses = (node) => Result.flatMap(stepUses(node), (uses) => {
|
|
|
1194
1070
|
const boolOrString = untagged(map(boolean)(String), string$1);
|
|
1195
1071
|
const stepHead = (fields) => Result.gen(function* decode() {
|
|
1196
1072
|
return {
|
|
1197
|
-
id: yield* optional
|
|
1198
|
-
if: yield* optional
|
|
1199
|
-
name: yield* optional
|
|
1073
|
+
id: yield* optional("id")(string$1)(fields),
|
|
1074
|
+
if: yield* optional("if")(ifCondition)(fields),
|
|
1075
|
+
name: yield* optional("name")(string$1)(fields)
|
|
1200
1076
|
};
|
|
1201
1077
|
});
|
|
1202
1078
|
// src/app/presets/features/audit-workflows/lib/action-decode.ts
|
|
@@ -1205,24 +1081,24 @@ const emptyEnv$1 = () => ({
|
|
|
1205
1081
|
value: /* @__PURE__ */ new Map()
|
|
1206
1082
|
});
|
|
1207
1083
|
const input = struct((fields) => Result.all([
|
|
1208
|
-
optional
|
|
1209
|
-
optional
|
|
1210
|
-
optional
|
|
1084
|
+
optional("description")(anyScalar)(fields),
|
|
1085
|
+
optional("required")(boolean)(fields),
|
|
1086
|
+
optional("default")(anyScalar)(fields)
|
|
1211
1087
|
]));
|
|
1212
|
-
const output = struct((fields) => Result.all([optional
|
|
1088
|
+
const output = struct((fields) => Result.all([optional("description")(anyScalar)(fields), optional("value")(anyScalar)(fields)]));
|
|
1213
1089
|
const usesBody = struct((fields) => Result.gen(function* decode() {
|
|
1214
1090
|
return {
|
|
1215
1091
|
type: "uses",
|
|
1216
|
-
uses: yield* required
|
|
1092
|
+
uses: yield* required("uses")(stepUses)(fields),
|
|
1217
1093
|
with: yield* defaulted$1("with")(loe(env$2))(emptyEnv$1)(fields)
|
|
1218
1094
|
};
|
|
1219
1095
|
}));
|
|
1220
1096
|
const runBody = struct((fields) => Result.gen(function* decode() {
|
|
1221
1097
|
return {
|
|
1222
1098
|
type: "run",
|
|
1223
|
-
run: yield* required
|
|
1224
|
-
shell: yield* required
|
|
1225
|
-
workingDirectory: yield* optional
|
|
1099
|
+
run: yield* required("run")(string$1)(fields),
|
|
1100
|
+
shell: yield* required("shell")(loe(string$1))(fields),
|
|
1101
|
+
workingDirectory: yield* optional("working-directory")(string$1)(fields)
|
|
1226
1102
|
};
|
|
1227
1103
|
}));
|
|
1228
1104
|
const step$18 = struct((fields) => Result.gen(function* decode() {
|
|
@@ -1244,12 +1120,12 @@ const dockerImage$1 = untagged((node) => Result.liftPredicate({ type: "dockerfil
|
|
|
1244
1120
|
image
|
|
1245
1121
|
})));
|
|
1246
1122
|
const runs = untagged(struct((fields) => Result.gen(function* decode() {
|
|
1247
|
-
const using = yield* required
|
|
1248
|
-
yield* required
|
|
1249
|
-
yield* optional
|
|
1250
|
-
yield* optional
|
|
1251
|
-
yield* optional
|
|
1252
|
-
yield* optional
|
|
1123
|
+
const using = yield* required("using")(string$1)(fields);
|
|
1124
|
+
yield* required("main")(string$1)(fields);
|
|
1125
|
+
yield* optional("pre")(string$1)(fields);
|
|
1126
|
+
yield* optional("pre-if")(ifCondition)(fields);
|
|
1127
|
+
yield* optional("post")(string$1)(fields);
|
|
1128
|
+
yield* optional("post-if")(ifCondition)(fields);
|
|
1253
1129
|
return {
|
|
1254
1130
|
type: "javascript",
|
|
1255
1131
|
using
|
|
@@ -1257,18 +1133,18 @@ const runs = untagged(struct((fields) => Result.gen(function* decode() {
|
|
|
1257
1133
|
})), struct((fields) => Result.gen(function* decode() {
|
|
1258
1134
|
return {
|
|
1259
1135
|
type: "composite",
|
|
1260
|
-
using: yield* required
|
|
1261
|
-
steps: yield* required
|
|
1136
|
+
using: yield* required("using")(string$1)(fields),
|
|
1137
|
+
steps: yield* required("steps")(sequence$2(step$18))(fields)
|
|
1262
1138
|
};
|
|
1263
1139
|
})), struct((fields) => Result.gen(function* decode() {
|
|
1264
|
-
const using = yield* required
|
|
1265
|
-
const image = yield* required
|
|
1140
|
+
const using = yield* required("using")(string$1)(fields);
|
|
1141
|
+
const image = yield* required("image")(dockerImage$1)(fields);
|
|
1266
1142
|
const dockerEnv = yield* defaulted$1("env")(env$2)(() => /* @__PURE__ */ new Map())(fields);
|
|
1267
|
-
yield* optional
|
|
1268
|
-
yield* optional
|
|
1269
|
-
yield* optional
|
|
1270
|
-
yield* optional
|
|
1271
|
-
yield* optional
|
|
1143
|
+
yield* optional("entrypoint")(string$1)(fields);
|
|
1144
|
+
yield* optional("pre-entrypoint")(string$1)(fields);
|
|
1145
|
+
yield* optional("pre-if")(ifCondition)(fields);
|
|
1146
|
+
yield* optional("post-entrypoint")(string$1)(fields);
|
|
1147
|
+
yield* optional("post-if")(ifCondition)(fields);
|
|
1272
1148
|
return {
|
|
1273
1149
|
type: "docker",
|
|
1274
1150
|
using,
|
|
@@ -1277,12 +1153,12 @@ const runs = untagged(struct((fields) => Result.gen(function* decode() {
|
|
|
1277
1153
|
};
|
|
1278
1154
|
})));
|
|
1279
1155
|
const decodeAction$1 = struct((fields) => Result.gen(function* decode() {
|
|
1280
|
-
const name = yield* optional
|
|
1281
|
-
yield* optional
|
|
1282
|
-
yield* optional
|
|
1156
|
+
const name = yield* optional("name")(anyScalar)(fields);
|
|
1157
|
+
yield* optional("author")(anyScalar)(fields);
|
|
1158
|
+
yield* optional("description")(anyScalar)(fields);
|
|
1283
1159
|
const inputs = yield* defaulted$1("inputs")(record(input))(() => /* @__PURE__ */ new Map())(fields);
|
|
1284
1160
|
yield* defaulted$1("outputs")(record(output))(() => /* @__PURE__ */ new Map())(fields);
|
|
1285
|
-
const each = yield* required
|
|
1161
|
+
const each = yield* required("runs")(runs)(fields);
|
|
1286
1162
|
return {
|
|
1287
1163
|
name,
|
|
1288
1164
|
inputs: [...inputs.keys()],
|
|
@@ -1372,7 +1248,7 @@ const lenientUnsigned = unsignedFrom(anyScalar, (text) => ({
|
|
|
1372
1248
|
value: Number(text),
|
|
1373
1249
|
isInteger: DIGITS$3.test(text)
|
|
1374
1250
|
}));
|
|
1375
|
-
const strings$
|
|
1251
|
+
const strings$1 = sequence$2(string$1);
|
|
1376
1252
|
const intervals = literal$1(INTERVALS);
|
|
1377
1253
|
const days = literal$1(DAYS);
|
|
1378
1254
|
const dependencyTypes = literal$1(DEPENDENCY_TYPES);
|
|
@@ -1393,59 +1269,59 @@ const versioningStrategies = literal$1([
|
|
|
1393
1269
|
"widen"
|
|
1394
1270
|
]);
|
|
1395
1271
|
const schedule$1 = struct((fields) => Result.gen(function* decode() {
|
|
1396
|
-
const interval = yield* required
|
|
1397
|
-
yield* optional
|
|
1398
|
-
yield* optional
|
|
1399
|
-
yield* optional
|
|
1400
|
-
const cronjob = yield* optional
|
|
1272
|
+
const interval = yield* required("interval")(intervals)(fields);
|
|
1273
|
+
yield* optional("day")(days)(fields);
|
|
1274
|
+
yield* optional("time")(string$1)(fields);
|
|
1275
|
+
yield* optional("timezone")(string$1)(fields);
|
|
1276
|
+
const cronjob = yield* optional("cronjob")(string$1)(fields);
|
|
1401
1277
|
if (interval === "cron" !== Option.isSome(cronjob)) return yield* Result.fail("invalid schedule");
|
|
1402
1278
|
return interval;
|
|
1403
1279
|
}));
|
|
1404
1280
|
const commitMessage = struct((fields) => Result.all([
|
|
1405
|
-
optional
|
|
1406
|
-
optional
|
|
1407
|
-
optional
|
|
1281
|
+
optional("prefix")(string$1)(fields),
|
|
1282
|
+
optional("prefix-development")(string$1)(fields),
|
|
1283
|
+
optional("include")(string$1)(fields)
|
|
1408
1284
|
]));
|
|
1409
|
-
const branchName = struct((fields) => optional
|
|
1285
|
+
const branchName = struct((fields) => optional("separator")(string$1)(fields));
|
|
1410
1286
|
const cooldown = struct((fields) => Result.gen(function* decode() {
|
|
1411
|
-
const defaultDays = yield* optional
|
|
1412
|
-
yield* optional
|
|
1413
|
-
yield* optional
|
|
1414
|
-
yield* optional
|
|
1415
|
-
yield* defaulted$1("include")(strings$
|
|
1416
|
-
yield* defaulted$1("exclude")(strings$
|
|
1287
|
+
const defaultDays = yield* optional("default-days")(unsigned$1)(fields);
|
|
1288
|
+
yield* optional("semver-major-days")(unsigned$1)(fields);
|
|
1289
|
+
yield* optional("semver-minor-days")(unsigned$1)(fields);
|
|
1290
|
+
yield* optional("semver-patch-days")(unsigned$1)(fields);
|
|
1291
|
+
yield* defaulted$1("include")(strings$1)(noStrings$2)(fields);
|
|
1292
|
+
yield* defaulted$1("exclude")(strings$1)(noStrings$2)(fields);
|
|
1417
1293
|
return { defaultDays };
|
|
1418
1294
|
}));
|
|
1419
1295
|
const group = struct((fields) => Result.all([
|
|
1420
|
-
optional
|
|
1421
|
-
defaulted$1("patterns")(strings$
|
|
1422
|
-
defaulted$1("exclude-patterns")(strings$
|
|
1296
|
+
optional("dependency-type")(dependencyTypes)(fields),
|
|
1297
|
+
defaulted$1("patterns")(strings$1)(noStrings$2)(fields),
|
|
1298
|
+
defaulted$1("exclude-patterns")(strings$1)(noStrings$2)(fields),
|
|
1423
1299
|
defaulted$1("update-types")(updateTypes)(() => [])(fields)
|
|
1424
1300
|
]));
|
|
1425
|
-
const allowEntries = sequence$2(struct((each) => Result.all([optional
|
|
1301
|
+
const allowEntries = sequence$2(struct((each) => Result.all([optional("dependency-name")(string$1)(each), optional("dependency-type")(dependencyTypes)(each)])));
|
|
1426
1302
|
const groups = record(group);
|
|
1427
1303
|
const validateUpdate = (fields) => Result.all([
|
|
1428
1304
|
defaulted$1("allow")(allowEntries)(() => [])(fields),
|
|
1429
|
-
defaulted$1("assignees")(strings$
|
|
1305
|
+
defaulted$1("assignees")(strings$1)(noStrings$2)(fields),
|
|
1430
1306
|
defaulted$1("groups")(groups)(noEntries)(fields),
|
|
1431
1307
|
defaulted$1("open-pull-requests-limit")(unsigned$1)(() => NO_LIMIT)(fields),
|
|
1432
1308
|
defaulted$1("rebase-strategy")(rebaseStrategies)(() => "auto")(fields),
|
|
1433
1309
|
defaulted$1("registries")(registries)(noStrings$2)(fields),
|
|
1434
|
-
defaulted$1("reviewers")(strings$
|
|
1435
|
-
optional
|
|
1310
|
+
defaulted$1("reviewers")(strings$1)(noStrings$2)(fields),
|
|
1311
|
+
optional("schedule")(schedule$1)(fields),
|
|
1436
1312
|
defaulted$1("vendor")(boolean)(() => false)(fields),
|
|
1437
|
-
optional
|
|
1438
|
-
optional
|
|
1313
|
+
optional("versioning-strategy")(versioningStrategies)(fields),
|
|
1314
|
+
optional("exclude-paths")(strings$1)(fields)
|
|
1439
1315
|
]);
|
|
1440
1316
|
const placementOf = (fields) => Result.all({
|
|
1441
|
-
directory: optional
|
|
1442
|
-
directories: optional
|
|
1443
|
-
multiEcosystemGroup: optional
|
|
1444
|
-
patterns: optional
|
|
1445
|
-
milestone: optional
|
|
1446
|
-
targetBranch: optional
|
|
1447
|
-
commitMessage: optional
|
|
1448
|
-
branchName: optional
|
|
1317
|
+
directory: optional("directory")(string$1)(fields),
|
|
1318
|
+
directories: optional("directories")(strings$1)(fields),
|
|
1319
|
+
multiEcosystemGroup: optional("multi-ecosystem-group")(string$1)(fields),
|
|
1320
|
+
patterns: optional("patterns")(strings$1)(fields),
|
|
1321
|
+
milestone: optional("milestone")(unsigned$1)(fields),
|
|
1322
|
+
targetBranch: optional("target-branch")(string$1)(fields),
|
|
1323
|
+
commitMessage: optional("commit-message")(commitMessage)(fields),
|
|
1324
|
+
branchName: optional("pull-request-branch-name")(branchName)(fields)
|
|
1449
1325
|
});
|
|
1450
1326
|
const conflictsWithGroup = (placement) => Option.isNone(placement.patterns) || Option.isSome(placement.milestone) || Option.isSome(placement.targetBranch) || Option.isSome(placement.commitMessage) || Option.isSome(placement.branchName);
|
|
1451
1327
|
const checkPlacement = (placement) => {
|
|
@@ -1457,27 +1333,27 @@ const update = struct((fields) => Result.gen(function* decode() {
|
|
|
1457
1333
|
yield* validateUpdate(fields);
|
|
1458
1334
|
const multiEcosystemGroup = yield* pipe(placementOf(fields), Result.flatMap(checkPlacement));
|
|
1459
1335
|
return {
|
|
1460
|
-
packageEcosystem: yield* required
|
|
1336
|
+
packageEcosystem: yield* required("package-ecosystem")(ecosystems)(fields),
|
|
1461
1337
|
insecureExternalCodeExecution: yield* defaulted$1("insecure-external-code-execution")(insecureModes)(() => "deny")(fields),
|
|
1462
|
-
cooldown: yield* optional
|
|
1338
|
+
cooldown: yield* optional("cooldown")(cooldown)(fields),
|
|
1463
1339
|
multiEcosystemGroup
|
|
1464
1340
|
};
|
|
1465
1341
|
}));
|
|
1466
1342
|
const multiGroups = record(struct((fields) => Result.all([
|
|
1467
|
-
required
|
|
1468
|
-
defaulted$1("labels")(strings$
|
|
1469
|
-
optional
|
|
1470
|
-
defaulted$1("assignees")(strings$
|
|
1471
|
-
optional
|
|
1472
|
-
optional
|
|
1473
|
-
optional
|
|
1343
|
+
required("schedule")(schedule$1)(fields),
|
|
1344
|
+
defaulted$1("labels")(strings$1)(noStrings$2)(fields),
|
|
1345
|
+
optional("milestone")(unsigned$1)(fields),
|
|
1346
|
+
defaulted$1("assignees")(strings$1)(noStrings$2)(fields),
|
|
1347
|
+
optional("target-branch")(string$1)(fields),
|
|
1348
|
+
optional("commit-message")(commitMessage)(fields),
|
|
1349
|
+
optional("pull-request-branch-name")(branchName)(fields)
|
|
1474
1350
|
])));
|
|
1475
1351
|
const updates = sequence$2(update);
|
|
1476
1352
|
const decodeDependabot = struct((fields) => Result.gen(function* decode() {
|
|
1477
|
-
yield* required
|
|
1353
|
+
yield* required("version")(lenientUnsigned)(fields);
|
|
1478
1354
|
yield* defaulted$1("enable-beta-ecosystems")(boolean)(() => false)(fields);
|
|
1479
1355
|
yield* defaulted$1("multi-ecosystem-groups")(multiGroups)(noEntries)(fields);
|
|
1480
|
-
return { updates: yield* required
|
|
1356
|
+
return { updates: yield* required("updates")(updates)(fields) };
|
|
1481
1357
|
}));
|
|
1482
1358
|
// src/app/presets/features/audit-workflows/lib/pre-commit-decode.ts
|
|
1483
1359
|
const SPECIAL$1 = /* @__PURE__ */ new Set([
|
|
@@ -1485,8 +1361,8 @@ const SPECIAL$1 = /* @__PURE__ */ new Set([
|
|
|
1485
1361
|
"meta",
|
|
1486
1362
|
"builtin"
|
|
1487
1363
|
]);
|
|
1488
|
-
const nonEmpty$
|
|
1489
|
-
const hook = struct((fields) => required
|
|
1364
|
+
const nonEmpty$1 = (item) => (node) => Result.flatMap(sequence$2(item)(node), (items) => Result.liftPredicate(items, (each) => Array$1.isReadonlyArrayNonEmpty(each), () => "expected at least one item in list"));
|
|
1365
|
+
const hook = struct((fields) => required("id")(string$1)(fields));
|
|
1490
1366
|
const parseUrl = (text) => Result.try({
|
|
1491
1367
|
try: () => {
|
|
1492
1368
|
const { href, protocol, hostname, pathname } = new URL(text);
|
|
@@ -1499,15 +1375,15 @@ const parseUrl = (text) => Result.try({
|
|
|
1499
1375
|
},
|
|
1500
1376
|
catch: () => `invalid URL: ${text}`
|
|
1501
1377
|
});
|
|
1502
|
-
const repo = struct((fields) => Result.flatMap(required
|
|
1378
|
+
const repo = struct((fields) => Result.flatMap(required("repo")(string$1)(fields), (name) => {
|
|
1503
1379
|
if (SPECIAL$1.has(name)) return Result.succeed({
|
|
1504
1380
|
type: "special",
|
|
1505
1381
|
repo: name
|
|
1506
1382
|
});
|
|
1507
1383
|
return Result.gen(function* decode() {
|
|
1508
1384
|
const url = yield* parseUrl(name);
|
|
1509
|
-
const rev = yield* required
|
|
1510
|
-
yield* required
|
|
1385
|
+
const rev = yield* required("rev")(string$1)(fields);
|
|
1386
|
+
yield* required("hooks")(nonEmpty$1(hook))(fields);
|
|
1511
1387
|
return {
|
|
1512
1388
|
type: "remote",
|
|
1513
1389
|
repo: name,
|
|
@@ -1516,15 +1392,15 @@ const repo = struct((fields) => Result.flatMap(required$1("repo")(string$1)(fiel
|
|
|
1516
1392
|
};
|
|
1517
1393
|
});
|
|
1518
1394
|
}));
|
|
1519
|
-
const decodePreCommitConfig = struct((fields) => Result.map(required
|
|
1395
|
+
const decodePreCommitConfig = struct((fields) => Result.map(required("repos")(nonEmpty$1(repo))(fields), (repos) => ({ repos })));
|
|
1520
1396
|
const hookDefinition = struct((fields) => Result.gen(function* decode() {
|
|
1521
|
-
const id = yield* required
|
|
1522
|
-
yield* required
|
|
1523
|
-
yield* required
|
|
1524
|
-
yield* required
|
|
1397
|
+
const id = yield* required("id")(anyScalar)(fields);
|
|
1398
|
+
yield* required("name")(anyScalar)(fields);
|
|
1399
|
+
yield* required("entry")(anyScalar)(fields);
|
|
1400
|
+
yield* required("language")(anyScalar)(fields);
|
|
1525
1401
|
return id;
|
|
1526
1402
|
}));
|
|
1527
|
-
const decodePreCommitHooks = (node) => Result.map(nonEmpty$
|
|
1403
|
+
const decodePreCommitHooks = (node) => Result.map(nonEmpty$1(hookDefinition)(node), (hooks) => ({ hooks }));
|
|
1528
1404
|
// src/app/presets/features/audit-workflows/model/common.ts
|
|
1529
1405
|
const CACHE_MODES = [
|
|
1530
1406
|
"read",
|
|
@@ -1537,7 +1413,7 @@ const emptyEnv = () => ({
|
|
|
1537
1413
|
type: "literal",
|
|
1538
1414
|
value: /* @__PURE__ */ new Map()
|
|
1539
1415
|
});
|
|
1540
|
-
const strings
|
|
1416
|
+
const strings = scalarOrVector(string$1);
|
|
1541
1417
|
const noStrings$1 = () => [];
|
|
1542
1418
|
// src/app/presets/features/audit-workflows/lib/job-decode.ts
|
|
1543
1419
|
const floatText = (raw) => {
|
|
@@ -1592,27 +1468,27 @@ const matrix$2 = struct((fields) => Result.gen(function* decode() {
|
|
|
1592
1468
|
const MINIMUM = 0;
|
|
1593
1469
|
const unsigned = (node) => Result.flatMap(number$1(node), (value) => Result.liftPredicate(value, (each) => node.tag === "!!int" && each >= MINIMUM, () => "expected u64"));
|
|
1594
1470
|
const strategy$1 = struct((fields) => Result.gen(function* decode() {
|
|
1595
|
-
const each = yield* optional
|
|
1596
|
-
yield* optional
|
|
1597
|
-
yield* optional
|
|
1471
|
+
const each = yield* optional("matrix")(loe(matrix$2))(fields);
|
|
1472
|
+
yield* optional("fail-fast")(loe(boolean))(fields);
|
|
1473
|
+
yield* optional("max-parallel")(loe(unsigned))(fields);
|
|
1598
1474
|
return { matrix: each };
|
|
1599
1475
|
}));
|
|
1600
1476
|
const dockerImage = loe(map(string$1)((raw) => parseDocker(raw)));
|
|
1601
1477
|
const credentials$1 = struct((fields) => Result.gen(function* decode() {
|
|
1602
1478
|
return {
|
|
1603
|
-
username: yield* optional
|
|
1604
|
-
password: yield* optional
|
|
1479
|
+
username: yield* optional("username")(string$1)(fields),
|
|
1480
|
+
password: yield* optional("password")(string$1)(fields)
|
|
1605
1481
|
};
|
|
1606
1482
|
}));
|
|
1607
1483
|
const container = untagged(map(dockerImage)((image) => ({
|
|
1608
1484
|
type: "name",
|
|
1609
1485
|
image
|
|
1610
1486
|
})), struct((fields) => Result.gen(function* decode() {
|
|
1611
|
-
const image = yield* required
|
|
1612
|
-
const creds = yield* optional
|
|
1487
|
+
const image = yield* required("image")(dockerImage)(fields);
|
|
1488
|
+
const creds = yield* optional("credentials")(credentials$1)(fields);
|
|
1613
1489
|
const containerEnv = yield* defaulted$1("env")(loe(env$2))(emptyEnv)(fields);
|
|
1614
1490
|
yield* defaulted$1("volumes")(sequence$2(string$1))(noStrings$1)(fields);
|
|
1615
|
-
yield* optional
|
|
1491
|
+
yield* optional("options")(string$1)(fields);
|
|
1616
1492
|
return {
|
|
1617
1493
|
type: "container",
|
|
1618
1494
|
image,
|
|
@@ -1660,39 +1536,39 @@ const BARE_EVENTS = [
|
|
|
1660
1536
|
"workflow_run"
|
|
1661
1537
|
];
|
|
1662
1538
|
const EVENTS = /* @__PURE__ */ new Set([...BARE_EVENTS, "schedule"]);
|
|
1663
|
-
const typesOf = struct((fields) => defaulted$1("types")(strings
|
|
1539
|
+
const typesOf = struct((fields) => defaulted$1("types")(strings)(noStrings$1)(fields));
|
|
1664
1540
|
const genericBody = typesOf;
|
|
1665
1541
|
const sequenceString = sequence$2(string$1);
|
|
1666
|
-
const imageVersion = struct((fields) => Result.map(Result.all([required
|
|
1667
|
-
const workflowRun = struct((fields) => Result.flatMap(required
|
|
1668
|
-
const cron = map(sequence$2(struct((fields) => Result.all([required
|
|
1669
|
-
const described = (fields) => Result.all([optional
|
|
1670
|
-
const callInput
|
|
1542
|
+
const imageVersion = struct((fields) => Result.map(Result.all([required("names")(sequenceString)(fields), required("versions")(sequenceString)(fields)]), noStrings$1));
|
|
1543
|
+
const workflowRun = struct((fields) => Result.flatMap(required("workflows")(sequence$2(string$1))(fields), () => typesOf(fields.node)));
|
|
1544
|
+
const cron = map(sequence$2(struct((fields) => Result.all([required("cron")(string$1)(fields), optional("timezone")(string$1)(fields)]))))(noStrings$1);
|
|
1545
|
+
const described = (fields) => Result.all([optional("description")(string$1)(fields), defaulted$1("required")(boolean)(() => false)(fields)]);
|
|
1546
|
+
const callInput = struct((fields) => Result.gen(function* decode() {
|
|
1671
1547
|
yield* described(fields);
|
|
1672
|
-
return yield* required
|
|
1548
|
+
return yield* required("type")(literal$1([
|
|
1673
1549
|
"boolean",
|
|
1674
1550
|
"number",
|
|
1675
1551
|
"string"
|
|
1676
1552
|
]))(fields);
|
|
1677
1553
|
}));
|
|
1678
|
-
const callOutput
|
|
1679
|
-
yield* optional
|
|
1680
|
-
return yield* required
|
|
1554
|
+
const callOutput = struct((fields) => Result.gen(function* decode() {
|
|
1555
|
+
yield* optional("description")(string$1)(fields);
|
|
1556
|
+
return yield* required("value")(string$1)(fields);
|
|
1681
1557
|
}));
|
|
1682
|
-
const callSecret
|
|
1558
|
+
const callSecret = struct(described);
|
|
1683
1559
|
const nullAsTrue = map(unit)(() => true);
|
|
1684
|
-
const callSecrets
|
|
1685
|
-
const callInputs = record(callInput
|
|
1686
|
-
const callOutputs = record(callOutput
|
|
1560
|
+
const callSecrets = record(untagged(nullAsTrue, map(callSecret)(() => true)));
|
|
1561
|
+
const callInputs = record(callInput);
|
|
1562
|
+
const callOutputs = record(callOutput);
|
|
1687
1563
|
const emptyMap = () => /* @__PURE__ */ new Map();
|
|
1688
1564
|
const workflowCall$1 = struct((fields) => Result.gen(function* decode() {
|
|
1689
1565
|
return {
|
|
1690
1566
|
inputs: yield* defaulted$1("inputs")(callInputs)(emptyMap)(fields),
|
|
1691
1567
|
outputs: yield* defaulted$1("outputs")(callOutputs)(emptyMap)(fields),
|
|
1692
|
-
secrets: [...(yield* defaulted$1("secrets")(callSecrets
|
|
1568
|
+
secrets: [...(yield* defaulted$1("secrets")(callSecrets)(emptyMap)(fields)).keys()]
|
|
1693
1569
|
};
|
|
1694
1570
|
}));
|
|
1695
|
-
const dispatchInput
|
|
1571
|
+
const dispatchInput = struct((fields) => Result.gen(function* decode() {
|
|
1696
1572
|
yield* described(fields);
|
|
1697
1573
|
const type = yield* defaulted$1("type")(literal$1([
|
|
1698
1574
|
"boolean",
|
|
@@ -1704,7 +1580,7 @@ const dispatchInput$1 = struct((fields) => Result.gen(function* decode() {
|
|
|
1704
1580
|
yield* defaulted$1("options")(sequence$2(envValue))(() => [])(fields);
|
|
1705
1581
|
return type;
|
|
1706
1582
|
}));
|
|
1707
|
-
const workflowDispatch = struct((fields) => Result.map(defaulted$1("inputs")(record(dispatchInput
|
|
1583
|
+
const workflowDispatch = struct((fields) => Result.map(defaulted$1("inputs")(record(dispatchInput))(() => /* @__PURE__ */ new Map())(fields), (inputs) => ({ inputs })));
|
|
1708
1584
|
const BODIES = {
|
|
1709
1585
|
image_version: imageVersion,
|
|
1710
1586
|
workflow_run: workflowRun,
|
|
@@ -1724,8 +1600,8 @@ const eventBody = (name) => (node) => {
|
|
|
1724
1600
|
const namedBody = (fields) => (name) => pipe(Result.fromOption(nodeAt(fields)(name), () => `missing field \`${name}\``), Result.flatMap(eventBody(name)), Result.map((body) => [name, body]));
|
|
1725
1601
|
const eventsOf = (fields) => pipe(Array$1.fromIterable(fields.entries.keys()), Array$1.filter((name) => EVENTS.has(name)), Array$1.map(namedBody(fields)), Result.all);
|
|
1726
1602
|
const mappingTrigger = struct((fields) => pipe(eventsOf(fields), Result.flatMap((events) => Result.gen(function* decode() {
|
|
1727
|
-
const call = yield* optional
|
|
1728
|
-
const dispatch = yield* optional
|
|
1603
|
+
const call = yield* optional("workflow_call")(workflowCall$1)(fields);
|
|
1604
|
+
const dispatch = yield* optional("workflow_dispatch")(workflowDispatch)(fields);
|
|
1729
1605
|
return {
|
|
1730
1606
|
events: new Map(events),
|
|
1731
1607
|
syntax: { type: "mapping" },
|
|
@@ -1761,18 +1637,18 @@ const trigger = untagged(mappingTrigger, map(bareEvent)((name) => ({
|
|
|
1761
1637
|
// src/app/presets/features/audit-workflows/lib/workflow-decode.ts
|
|
1762
1638
|
const runDefaults = struct((fields) => Result.gen(function* decode() {
|
|
1763
1639
|
return {
|
|
1764
|
-
shell: yield* optional
|
|
1765
|
-
workingDirectory: yield* optional
|
|
1640
|
+
shell: yield* optional("shell")(loe(string$1))(fields),
|
|
1641
|
+
workingDirectory: yield* optional("working-directory")(anyScalar)(fields)
|
|
1766
1642
|
};
|
|
1767
1643
|
}));
|
|
1768
|
-
const defaults = struct((fields) => Result.map(optional
|
|
1644
|
+
const defaults = struct((fields) => Result.map(optional("run")(runDefaults)(fields), (run) => ({ run })));
|
|
1769
1645
|
const concurrency$1 = untagged(map(string$1)((group) => ({
|
|
1770
1646
|
type: "bare",
|
|
1771
1647
|
group
|
|
1772
1648
|
})), struct((fields) => Result.gen(function* decode() {
|
|
1773
1649
|
return {
|
|
1774
1650
|
type: "rich",
|
|
1775
|
-
group: yield* required
|
|
1651
|
+
group: yield* required("group")(string$1)(fields),
|
|
1776
1652
|
cancelInProgress: yield* defaulted$1("cancel-in-progress")(loe(boolean))(() => ({
|
|
1777
1653
|
type: "literal",
|
|
1778
1654
|
value: false
|
|
@@ -1780,15 +1656,15 @@ const concurrency$1 = untagged(map(string$1)((group) => ({
|
|
|
1780
1656
|
};
|
|
1781
1657
|
})));
|
|
1782
1658
|
const runsOnGroup = struct((fields) => Result.gen(function* decode() {
|
|
1783
|
-
const group = yield* optional
|
|
1784
|
-
const labels = yield* defaulted$1("labels")(strings
|
|
1659
|
+
const group = yield* optional("group")(string$1)(fields);
|
|
1660
|
+
const labels = yield* defaulted$1("labels")(strings)(noStrings$1)(fields);
|
|
1785
1661
|
return yield* Result.liftPredicate({
|
|
1786
1662
|
type: "group",
|
|
1787
1663
|
group,
|
|
1788
1664
|
labels
|
|
1789
1665
|
}, () => Option.isSome(group) || Array$1.isReadonlyArrayNonEmpty(labels), () => "runs-on must provide either `group` or one or more `labels`");
|
|
1790
1666
|
}));
|
|
1791
|
-
const runsOn = untagged(map(strings
|
|
1667
|
+
const runsOn = untagged(map(strings)((labels) => ({
|
|
1792
1668
|
type: "target",
|
|
1793
1669
|
labels
|
|
1794
1670
|
})), runsOnGroup);
|
|
@@ -1798,13 +1674,13 @@ const environment = untagged(map(string$1)((name) => ({
|
|
|
1798
1674
|
})), struct((fields) => Result.gen(function* decode() {
|
|
1799
1675
|
return {
|
|
1800
1676
|
type: "name-url",
|
|
1801
|
-
name: yield* required
|
|
1802
|
-
url: yield* optional
|
|
1677
|
+
name: yield* required("name")(string$1)(fields),
|
|
1678
|
+
url: yield* optional("url")(string$1)(fields)
|
|
1803
1679
|
};
|
|
1804
1680
|
})));
|
|
1805
1681
|
const shared = (fields) => Result.gen(function* decode() {
|
|
1806
1682
|
const head = yield* stepHead(fields);
|
|
1807
|
-
yield* optional
|
|
1683
|
+
yield* optional("timeout-minutes")(loe(number$1))(fields);
|
|
1808
1684
|
yield* defaulted$1("continue-on-error")(loe(boolean))(() => ({
|
|
1809
1685
|
type: "literal",
|
|
1810
1686
|
value: false
|
|
@@ -1817,7 +1693,7 @@ const shared = (fields) => Result.gen(function* decode() {
|
|
|
1817
1693
|
};
|
|
1818
1694
|
});
|
|
1819
1695
|
const usesStep = struct((fields) => Result.gen(function* decode() {
|
|
1820
|
-
const uses = yield* required
|
|
1696
|
+
const uses = yield* required("uses")(stepUses)(fields);
|
|
1821
1697
|
const withs = yield* defaulted$1("with")(loe(env$2))(emptyEnv)(fields);
|
|
1822
1698
|
return {
|
|
1823
1699
|
...yield* shared(fields),
|
|
@@ -1829,9 +1705,9 @@ const usesStep = struct((fields) => Result.gen(function* decode() {
|
|
|
1829
1705
|
};
|
|
1830
1706
|
}));
|
|
1831
1707
|
const runStep = struct((fields) => Result.gen(function* decode() {
|
|
1832
|
-
const run = yield* required
|
|
1833
|
-
const workingDirectory = yield* optional
|
|
1834
|
-
const shell = yield* optional
|
|
1708
|
+
const run = yield* required("run")(boolOrString)(fields);
|
|
1709
|
+
const workingDirectory = yield* optional("working-directory")(string$1)(fields);
|
|
1710
|
+
const shell = yield* optional("shell")(loe(string$1))(fields);
|
|
1835
1711
|
return {
|
|
1836
1712
|
...yield* shared(fields),
|
|
1837
1713
|
body: {
|
|
@@ -1843,25 +1719,25 @@ const runStep = struct((fields) => Result.gen(function* decode() {
|
|
|
1843
1719
|
};
|
|
1844
1720
|
}));
|
|
1845
1721
|
const control = (field, decoder) => struct((fields) => Result.gen(function* decode() {
|
|
1846
|
-
yield* optional
|
|
1847
|
-
yield* optional
|
|
1848
|
-
yield* required
|
|
1722
|
+
yield* optional("name")(string$1)(fields);
|
|
1723
|
+
yield* optional("id")(string$1)(fields);
|
|
1724
|
+
yield* required(field)(decoder)(fields);
|
|
1849
1725
|
return { type: "control" };
|
|
1850
1726
|
}));
|
|
1851
1727
|
const stepModel = untagged(usesStep, runStep);
|
|
1852
1728
|
const step$17 = untagged(map(stepModel)((each) => ({
|
|
1853
1729
|
type: "step",
|
|
1854
1730
|
step: each
|
|
1855
|
-
})), control("wait", strings
|
|
1731
|
+
})), control("wait", strings), control("wait-all", untagged(boolean, nullAsTrue)), control("cancel", string$1), struct((fields) => Result.map(required("parallel")(sequence$2(stepModel))(fields), (steps) => ({
|
|
1856
1732
|
type: "parallel",
|
|
1857
1733
|
steps
|
|
1858
1734
|
}))));
|
|
1859
1735
|
const jobCommon = (fields) => Result.all({
|
|
1860
|
-
name: optional
|
|
1861
|
-
cacheMode: optional
|
|
1736
|
+
name: optional("name")(string$1)(fields),
|
|
1737
|
+
cacheMode: optional("cache-mode")(literal$1(CACHE_MODES))(fields),
|
|
1862
1738
|
permissions: defaulted$1("permissions")(permissions$1)(() => DEFAULT_PERMISSIONS$1)(fields),
|
|
1863
|
-
needs: defaulted$1("needs")(strings
|
|
1864
|
-
if: optional
|
|
1739
|
+
needs: defaulted$1("needs")(strings)(noStrings$1)(fields),
|
|
1740
|
+
if: optional("if")(ifCondition)(fields)
|
|
1865
1741
|
});
|
|
1866
1742
|
const loeBoolean = loe(boolean);
|
|
1867
1743
|
const loeNumber = loe(number$1);
|
|
@@ -1870,20 +1746,20 @@ const loeEnv = loe(env$2);
|
|
|
1870
1746
|
const loeRunsOn = loe(runsOn);
|
|
1871
1747
|
const normalJob = struct((fields) => Result.map(Result.all({
|
|
1872
1748
|
common: jobCommon(fields),
|
|
1873
|
-
runsOn: required
|
|
1874
|
-
environment: optional
|
|
1875
|
-
concurrency: optional
|
|
1749
|
+
runsOn: required("runs-on")(loeRunsOn)(fields),
|
|
1750
|
+
environment: optional("environment")(environment)(fields),
|
|
1751
|
+
concurrency: optional("concurrency")(concurrency$1)(fields),
|
|
1876
1752
|
outputs: defaulted$1("outputs")(env$2)(() => /* @__PURE__ */ new Map())(fields),
|
|
1877
1753
|
env: defaulted$1("env")(loeEnv)(emptyEnv)(fields),
|
|
1878
|
-
defaults: optional
|
|
1879
|
-
steps: required
|
|
1880
|
-
timeout: optional
|
|
1881
|
-
strategy: optional
|
|
1754
|
+
defaults: optional("defaults")(defaults)(fields),
|
|
1755
|
+
steps: required("steps")(sequenceStep)(fields),
|
|
1756
|
+
timeout: optional("timeout-minutes")(loeNumber)(fields),
|
|
1757
|
+
strategy: optional("strategy")(strategy$1)(fields),
|
|
1882
1758
|
continueOnError: defaulted$1("continue-on-error")(loeBoolean)(() => ({
|
|
1883
1759
|
type: "literal",
|
|
1884
1760
|
value: false
|
|
1885
1761
|
}))(fields),
|
|
1886
|
-
container: optional
|
|
1762
|
+
container: optional("container")(container)(fields),
|
|
1887
1763
|
services: defaulted$1("services")(services)(() => [])(fields)
|
|
1888
1764
|
}), ({ common, outputs: _outputs, timeout: _timeout, continueOnError: _continue, ...rest }) => ({
|
|
1889
1765
|
type: "normal",
|
|
@@ -1897,9 +1773,9 @@ const secrets$1 = untagged(map(literal$1(["inherit"]))(() => ({ type: "inherit"
|
|
|
1897
1773
|
})));
|
|
1898
1774
|
const job$1 = untagged(normalJob, struct((fields) => Result.map(Result.all({
|
|
1899
1775
|
common: jobCommon(fields),
|
|
1900
|
-
uses: required
|
|
1776
|
+
uses: required("uses")(reusableUses)(fields),
|
|
1901
1777
|
with: defaulted$1("with")(loeEnv)(emptyEnv)(fields),
|
|
1902
|
-
secrets: optional
|
|
1778
|
+
secrets: optional("secrets")(secrets$1)(fields)
|
|
1903
1779
|
}), ({ common, ...rest }) => ({
|
|
1904
1780
|
type: "reusable",
|
|
1905
1781
|
...common,
|
|
@@ -1907,19 +1783,19 @@ const job$1 = untagged(normalJob, struct((fields) => Result.map(Result.all({
|
|
|
1907
1783
|
}))));
|
|
1908
1784
|
const jobs$1 = (node) => Result.flatMap(entriesOf(node), (entries) => Result.all(pipe(entries, Array$1.map(([id, each]) => Result.map(job$1(each), (decoded) => [id, decoded])))));
|
|
1909
1785
|
const decodeWorkflow = struct((fields) => Result.all({
|
|
1910
|
-
name: optional
|
|
1911
|
-
runName: optional
|
|
1912
|
-
on: required
|
|
1913
|
-
cacheMode: optional
|
|
1786
|
+
name: optional("name")(anyScalar)(fields),
|
|
1787
|
+
runName: optional("run-name")(anyScalar)(fields),
|
|
1788
|
+
on: required("on")(trigger)(fields),
|
|
1789
|
+
cacheMode: optional("cache-mode")(literal$1(CACHE_MODES))(fields),
|
|
1914
1790
|
permissions: defaulted$1("permissions")(permissions$1)(() => DEFAULT_PERMISSIONS$1)(fields),
|
|
1915
1791
|
env: defaulted$1("env")(loe(env$2))(emptyEnv)(fields),
|
|
1916
|
-
defaults: optional
|
|
1917
|
-
concurrency: optional
|
|
1918
|
-
jobs: required
|
|
1792
|
+
defaults: optional("defaults")(defaults)(fields),
|
|
1793
|
+
concurrency: optional("concurrency")(concurrency$1)(fields),
|
|
1794
|
+
jobs: required("jobs")(jobs$1)(fields)
|
|
1919
1795
|
}));
|
|
1920
1796
|
// src/app/presets/features/audit-workflows/lib/input.ts
|
|
1921
1797
|
const HOOKS = ".pre-commit-hooks.yaml";
|
|
1922
|
-
const EMPTY$
|
|
1798
|
+
const EMPTY$1 = () => "empty input";
|
|
1923
1799
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
1924
1800
|
const preCommit = (base) => (node) => {
|
|
1925
1801
|
if (base.filename === HOOKS) return Result.map(decodePreCommitHooks(node), (model) => ({
|
|
@@ -1958,7 +1834,7 @@ const decoded = (kind, path, source) => Result.flatMap(documentOf(source), (docu
|
|
|
1958
1834
|
source,
|
|
1959
1835
|
document
|
|
1960
1836
|
});
|
|
1961
|
-
return pipe(Option.fromNullishOr(source.yaml), Result.fromOption(EMPTY$
|
|
1837
|
+
return pipe(Option.fromNullishOr(source.yaml), Result.fromOption(EMPTY$1), Result.flatMap(build));
|
|
1962
1838
|
});
|
|
1963
1839
|
const inputOf$2 = (kind) => (path) => (source) => cache.getOrInsertComputed(source, () => Result.getSuccess(decoded(kind, path, source)));
|
|
1964
1840
|
// src/app/presets/features/audit-workflows/model/finding.ts
|
|
@@ -2160,7 +2036,7 @@ const WRAP = 4294967296;
|
|
|
2160
2036
|
const MAX = 4294967295;
|
|
2161
2037
|
const INFINITY = "infinity";
|
|
2162
2038
|
const PREFIX = 2;
|
|
2163
|
-
const ZERO
|
|
2039
|
+
const ZERO = 0;
|
|
2164
2040
|
const signed32 = (value) => {
|
|
2165
2041
|
if (value >= SIGNED) return value - WRAP;
|
|
2166
2042
|
return value;
|
|
@@ -2183,9 +2059,9 @@ const prefixed$1 = (trimmed) => {
|
|
|
2183
2059
|
if (String$1.startsWith("0o")(trimmed)) return radix(String$1.slice(PREFIX)(trimmed), OCTAL$1, OCTAL_DIGITS);
|
|
2184
2060
|
return infinity(trimmed);
|
|
2185
2061
|
};
|
|
2186
|
-
const parseNumber$
|
|
2062
|
+
const parseNumber$1 = (text) => {
|
|
2187
2063
|
const trimmed = String$1.trim(text);
|
|
2188
|
-
if (String$1.isEmpty(trimmed)) return ZERO
|
|
2064
|
+
if (String$1.isEmpty(trimmed)) return ZERO;
|
|
2189
2065
|
return Option.getOrElse(decimal(trimmed), () => prefixed$1(trimmed));
|
|
2190
2066
|
};
|
|
2191
2067
|
// src/app/presets/entities/expression-tree/lib/evaluation.ts
|
|
@@ -2216,7 +2092,7 @@ const asBoolean = Match.type().pipe(Match.discriminatorsExhaustive("type")({
|
|
|
2216
2092
|
object: () => true
|
|
2217
2093
|
}));
|
|
2218
2094
|
const asNumber = Match.type().pipe(Match.discriminatorsExhaustive("type")({
|
|
2219
|
-
string: (value) => parseNumber$
|
|
2095
|
+
string: (value) => parseNumber$1(value.value),
|
|
2220
2096
|
number: (value) => value.value,
|
|
2221
2097
|
boolean: (value) => Number(value.value),
|
|
2222
2098
|
null: () => NULL_NUMBER,
|
|
@@ -2515,7 +2391,7 @@ const BOUNDARY = /* @__PURE__ */ new Set([
|
|
|
2515
2391
|
"&",
|
|
2516
2392
|
"|"
|
|
2517
2393
|
]);
|
|
2518
|
-
const SINGLE$
|
|
2394
|
+
const SINGLE$19 = /* @__PURE__ */ new Map([
|
|
2519
2395
|
["(", "("],
|
|
2520
2396
|
[")", ")"],
|
|
2521
2397
|
["[", "["],
|
|
@@ -2600,7 +2476,7 @@ const lexString$1 = (src, start) => Result.fromOption(Option.map(stringEnd(src,
|
|
|
2600
2476
|
}));
|
|
2601
2477
|
const lexNumber = (src, start) => {
|
|
2602
2478
|
const end = runEnd(src, start, (char) => !isBoundary(char) || char === ".");
|
|
2603
|
-
const value = parseNumber$
|
|
2479
|
+
const value = parseNumber$1(String$1.slice(start, end)(src));
|
|
2604
2480
|
if (Number.isNaN(value)) return Result.fail({
|
|
2605
2481
|
message: "invalid numeric literal",
|
|
2606
2482
|
offset: start
|
|
@@ -2659,7 +2535,7 @@ const lexPaired = (src, start) => pipe(Option.fromNullishOr(PAIRED[charAt$1(src)
|
|
|
2659
2535
|
const lexDot = (start, previous) => Option.map(pipe(previous, Option.filter((tok) => DOT_AFTER.has(tok))), () => Result.succeed(simple(".", start, start + NEXT$17)));
|
|
2660
2536
|
const lexSymbol = (src, start, previous) => {
|
|
2661
2537
|
const char = charAt$1(src)(start);
|
|
2662
|
-
return pipe(Option.fromNullishOr(SINGLE$
|
|
2538
|
+
return pipe(Option.fromNullishOr(SINGLE$19.get(char)), Option.map((tok) => Result.succeed(simple(tok, start, start + NEXT$17))), Option.orElse(() => lexPaired(src, start)), Option.orElse(() => Option.map(Option.liftPredicate(char, (each) => each === QUOTE$6), () => lexString$1(src, start))), Option.orElse(() => Option.flatMap(Option.liftPredicate(char, (each) => each === "."), () => lexDot(start, previous))));
|
|
2663
2539
|
};
|
|
2664
2540
|
const lexOne = (src, start, previous) => Option.getOrElse(lexSymbol(src, start, previous), () => {
|
|
2665
2541
|
if (NUMBER_START$1.test(charAt$1(src)(start))) return lexNumber(src, start);
|
|
@@ -2895,7 +2771,7 @@ const parseAll = (context) => {
|
|
|
2895
2771
|
return Result.succeed(step.value);
|
|
2896
2772
|
}));
|
|
2897
2773
|
};
|
|
2898
|
-
const parseExpression
|
|
2774
|
+
const parseExpression = (src) => pipe(lex(src), Result.mapError((issue) => ({ message: issue.message })), Result.flatMap((tokens) => parseAll(contextFor(src, tokens))));
|
|
2899
2775
|
// src/app/presets/entities/expression-tree/lib/walk.ts
|
|
2900
2776
|
const COMMUTATIVE = /* @__PURE__ */ new Set([
|
|
2901
2777
|
"and",
|
|
@@ -2985,8 +2861,8 @@ const commutativeMatches = (left) => (right) => {
|
|
|
2985
2861
|
return commutativeMatches(left.lhs.expr)(right.lhs.expr) && commutativeMatches(left.rhs.expr)(right.rhs.expr) || COMMUTATIVE.has(left.op) && commutativeMatches(left.lhs.expr)(right.rhs.expr) && commutativeMatches(left.rhs.expr)(right.lhs.expr);
|
|
2986
2862
|
};
|
|
2987
2863
|
// src/app/presets/features/audit-workflows/lib/expressions.ts
|
|
2988
|
-
const OPEN$
|
|
2989
|
-
const CLOSE$
|
|
2864
|
+
const OPEN$3 = "${{";
|
|
2865
|
+
const CLOSE$2 = "}}";
|
|
2990
2866
|
const QUOTE$5 = "'";
|
|
2991
2867
|
const BRACE = "}";
|
|
2992
2868
|
const START$9 = 0;
|
|
@@ -2994,7 +2870,7 @@ const NEXT$15 = 1;
|
|
|
2994
2870
|
const STATIC_FLAG = 2;
|
|
2995
2871
|
const extracted = (raw) => ({
|
|
2996
2872
|
raw,
|
|
2997
|
-
fenced: String$1.startsWith(OPEN$
|
|
2873
|
+
fenced: String$1.startsWith(OPEN$3)(raw) && String$1.endsWith(CLOSE$2)(raw)
|
|
2998
2874
|
});
|
|
2999
2875
|
const asBare = (expr) => {
|
|
3000
2876
|
if (!expr.fenced) return expr.raw;
|
|
@@ -3002,7 +2878,7 @@ const asBare = (expr) => {
|
|
|
3002
2878
|
};
|
|
3003
2879
|
const parseBare = (raw) => {
|
|
3004
2880
|
const bare = asBare(extracted(raw));
|
|
3005
|
-
return Result.getSuccess(parseExpression
|
|
2881
|
+
return Result.getSuccess(parseExpression(bare));
|
|
3006
2882
|
};
|
|
3007
2883
|
const charAt = (view) => (index) => String$1.slice(index, index + NEXT$15)(view);
|
|
3008
2884
|
const closingOf = (view) => (index, inString) => {
|
|
@@ -3022,7 +2898,7 @@ const fencedAt = (view, offset) => (start) => pipe(closingOf(view)(start, false)
|
|
|
3022
2898
|
})));
|
|
3023
2899
|
const extractFenced = (text) => (offset) => {
|
|
3024
2900
|
const view = String$1.slice(offset)(text);
|
|
3025
|
-
return pipe(view, String$1.indexOf(OPEN$
|
|
2901
|
+
return pipe(view, String$1.indexOf(OPEN$3), Option.flatMap(fencedAt(view, offset)));
|
|
3026
2902
|
};
|
|
3027
2903
|
const shifted = (bias) => (fenced) => ({
|
|
3028
2904
|
expr: fenced.expr,
|
|
@@ -3406,7 +3282,7 @@ const expandsToStaticValues = (matrix) => (context) => {
|
|
|
3406
3282
|
return !pipe(matrix.expansions, Array$1.some((expansion) => matchesPattern(expansion.path)(context) && !isStaticExpansion(expansion)));
|
|
3407
3283
|
};
|
|
3408
3284
|
// src/app/presets/features/audit-workflows/lib/workflow.ts
|
|
3409
|
-
const SINGLE$
|
|
3285
|
+
const SINGLE$18 = 1;
|
|
3410
3286
|
const DANGEROUS_TRIGGERS = [
|
|
3411
3287
|
"pull_request_target",
|
|
3412
3288
|
"workflow_run",
|
|
@@ -3431,7 +3307,7 @@ const triggerLocation = (workflow, event) => {
|
|
|
3431
3307
|
return withKeys(syntax.events.indexOf(event))(parent);
|
|
3432
3308
|
};
|
|
3433
3309
|
const triggerAt = (event) => (workflow) => Option.liftPredicate(triggerLocation(workflow, event), () => hasEvent(workflow)(event));
|
|
3434
|
-
const hasSingleTrigger = (workflow) => workflow.model.on.events.size === SINGLE$
|
|
3310
|
+
const hasSingleTrigger = (workflow) => workflow.model.on.events.size === SINGLE$18;
|
|
3435
3311
|
const isReusableOnly = (workflow) => hasEvent(workflow)("workflow_call") && hasSingleTrigger(workflow);
|
|
3436
3312
|
const isCacheWriteTrigger = (workflow) => pipe(CACHE_WRITE_EVENTS, Array$1.some((event) => hasEvent(workflow)(event)));
|
|
3437
3313
|
const callCapability = (type) => {
|
|
@@ -3793,11 +3669,11 @@ const withConfig = (known) => (raw) => pipe(loadConfig(known)(raw.rules), Result
|
|
|
3793
3669
|
online: raw.online !== false,
|
|
3794
3670
|
githubHost: raw.githubHost ?? "github.com"
|
|
3795
3671
|
})));
|
|
3796
|
-
const parse$
|
|
3672
|
+
const parse$2 = (known) => (raw) => pipe(decodeSettings(raw), Result.mapError((issue) => `invalid zizmor setting: ${issue.message}`), Result.flatMap(withConfig(known)));
|
|
3797
3673
|
const settingsOf$1 = (known) => {
|
|
3798
3674
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
3799
3675
|
const cached = (value) => {
|
|
3800
|
-
const parsed = parse$
|
|
3676
|
+
const parsed = parse$2(known)(value);
|
|
3801
3677
|
cache.set(value, parsed);
|
|
3802
3678
|
return parsed;
|
|
3803
3679
|
};
|
|
@@ -4194,7 +4070,7 @@ const spanLocation = (input) => (annotation) => (span) => ({
|
|
|
4194
4070
|
});
|
|
4195
4071
|
// src/app/presets/features/audit-workflows/lib/secret-count.ts
|
|
4196
4072
|
const NONE$12 = 0;
|
|
4197
|
-
const ONE$
|
|
4073
|
+
const ONE$4 = 1;
|
|
4198
4074
|
const none$1 = () => NONE$12;
|
|
4199
4075
|
const total = (count) => (items) => Array$1.reduce(items, NONE$12, (sum, item) => sum + count(item));
|
|
4200
4076
|
const counted = ({ func, hits, context }) => {
|
|
@@ -4203,7 +4079,7 @@ const counted = ({ func, hits, context }) => {
|
|
|
4203
4079
|
star: none$1,
|
|
4204
4080
|
identifier: none$1,
|
|
4205
4081
|
call: (expr) => Boolean$1.match(expr.func === func && pipe(expr.args, Array$1.some(hits)), {
|
|
4206
|
-
onTrue: () => ONE$
|
|
4082
|
+
onTrue: () => ONE$4,
|
|
4207
4083
|
onFalse: () => total(count)(expr.args)
|
|
4208
4084
|
}),
|
|
4209
4085
|
index: (expr) => count(expr.inner),
|
|
@@ -4229,7 +4105,7 @@ const secretAudit = (counter) => {
|
|
|
4229
4105
|
};
|
|
4230
4106
|
// src/app/presets/features/audit-workflows/model/rules/overprovisioned-secrets.ts
|
|
4231
4107
|
const isSecrets = matchesPattern("secrets");
|
|
4232
|
-
const ONE$
|
|
4108
|
+
const ONE$3 = 1;
|
|
4233
4109
|
const isSecretsHead = (head) => head.expr.type === "identifier" && String$1.toLowerCase(head.expr.name) === "secrets";
|
|
4234
4110
|
const isDynamicIndex = (index) => index.expr.type === "index" && index.expr.inner.expr.type !== "literal";
|
|
4235
4111
|
const isDynamicSecretIndex = (parts) => Array$1.match(parts, {
|
|
@@ -4246,7 +4122,7 @@ const overprovisionedSecrets = secretAudit({
|
|
|
4246
4122
|
func: "tojson",
|
|
4247
4123
|
hits: (arg) => arg.expr.type === "context" && isSecrets(arg.expr),
|
|
4248
4124
|
context: (count) => (expr) => Boolean$1.match(isDynamicSecretIndex(expr.parts), {
|
|
4249
|
-
onTrue: () => ONE$
|
|
4125
|
+
onTrue: () => ONE$3,
|
|
4250
4126
|
onFalse: () => total(count)(expr.parts)
|
|
4251
4127
|
})
|
|
4252
4128
|
});
|
|
@@ -4770,9 +4646,18 @@ const bashTargets = (node) => {
|
|
|
4770
4646
|
return [];
|
|
4771
4647
|
};
|
|
4772
4648
|
const bashDestinations = (nodes) => matching$1(BASH_DESTINATION)(pipe(nodes, Array$1.flatMap(bashTargets)));
|
|
4773
|
-
const SINGLE$
|
|
4649
|
+
const SINGLE$17 = 1;
|
|
4774
4650
|
const NEXT$13 = 1;
|
|
4775
|
-
const
|
|
4651
|
+
const RUNNER_VARIABLES = /* @__PURE__ */ new Set([
|
|
4652
|
+
"GITHUB_WORKSPACE",
|
|
4653
|
+
"GITHUB_ACTION_PATH",
|
|
4654
|
+
"RUNNER_TEMP",
|
|
4655
|
+
"RUNNER_TOOL_CACHE",
|
|
4656
|
+
"HOME"
|
|
4657
|
+
]);
|
|
4658
|
+
const isRunnerExpansion = (node) => node.type === "simple_expansion" && pipe(namedOfType("variable_name")(node), Array$1.every((name) => RUNNER_VARIABLES.has(name.text)));
|
|
4659
|
+
const isRunnerPath = (arg) => arg.type === "string" && pipe(arg.namedChildren, Array$1.every((child) => isType("string_content")(child) || isRunnerExpansion(child)));
|
|
4660
|
+
const isSafeArg = (arg) => isType("word", "raw_string")(arg) || arg.namedChildren.length === SINGLE$17 && pipe(arg.namedChildren, Array$1.every(isType("string_content"))) || isRunnerPath(arg);
|
|
4776
4661
|
const isStaticEcho = (command) => Option.exists(fieldTextOf("name")(command), (name) => ECHOES.has(name)) && pipe(fieldsOf$5("argument")(command), Array$1.filter((arg) => arg.named), Array$1.every(isSafeArg));
|
|
4777
4662
|
const isFlaggedCommand = (command) => command.type === "command" && fieldOf$2("name")(command).pipe(ofType("command_name"), Option.isSome) && !isStaticEcho(command);
|
|
4778
4663
|
const bashRedirects = (statement) => pipe(statement.namedChildren, Array$1.flatMap((command, index) => {
|
|
@@ -9789,7 +9674,7 @@ const orOperands = (spanned) => {
|
|
|
9789
9674
|
return [spanned];
|
|
9790
9675
|
};
|
|
9791
9676
|
const LAST$1 = 1;
|
|
9792
|
-
const SINGLE$
|
|
9677
|
+
const SINGLE$16 = 1;
|
|
9793
9678
|
const ANNOTATION$2 = pipe(rootLocation(""), annotated("pseudo-ternary has falsy true value"), primary);
|
|
9794
9679
|
const falsyTrueValue = (operand) => {
|
|
9795
9680
|
const { expr } = operand;
|
|
@@ -9799,7 +9684,7 @@ const falsyTrueValue = (operand) => {
|
|
|
9799
9684
|
const unsoundTrueValues = (spanned) => {
|
|
9800
9685
|
if (isConstant$1(spanned)) return [];
|
|
9801
9686
|
const operands = orOperands(spanned);
|
|
9802
|
-
if (operands.length > SINGLE$
|
|
9687
|
+
if (operands.length > SINGLE$16) return [...pipe(operands, Array$1.dropRight(LAST$1), Array$1.flatMap(falsyTrueValue)), ...pipe(operands, Array$1.flatMap(unsoundTrueValues))];
|
|
9803
9688
|
return pipe(childrenOf(spanned.expr), Array$1.flatMap(unsoundTrueValues));
|
|
9804
9689
|
};
|
|
9805
9690
|
// src/app/presets/features/audit-workflows/model/concerns/injection.ts
|
|
@@ -10926,11 +10811,11 @@ const NONE$11 = 0;
|
|
|
10926
10811
|
const NEXT$12 = 1;
|
|
10927
10812
|
const PAIR$2 = 2;
|
|
10928
10813
|
const ASCII_LIMIT = 127;
|
|
10929
|
-
const FIRST$
|
|
10814
|
+
const FIRST$5 = 0;
|
|
10930
10815
|
const VERSION_SUFFIX = /[0-9]+$/u;
|
|
10931
10816
|
const DASH_SUFFIX = /-+$/u;
|
|
10932
10817
|
const WORD_DELIMITER = /[-_/]/u;
|
|
10933
|
-
const isAscii = (char) => Option.exists(pipe(char, String$1.codePointAt(FIRST$
|
|
10818
|
+
const isAscii = (char) => Option.exists(pipe(char, String$1.codePointAt(FIRST$5)), (code) => code <= ASCII_LIMIT);
|
|
10934
10819
|
const charsOf = (text) => Array$1.fromIterable(text);
|
|
10935
10820
|
const joined = (chars) => Array$1.join(chars, "");
|
|
10936
10821
|
const ownerOf = (slug) => Option.getOrElse(Array$1.head(String$1.split("/")(slug)), () => slug);
|
|
@@ -11029,7 +10914,7 @@ const typosquatUses = {
|
|
|
11029
10914
|
preCommitRepo: repoTargetCheck(check$4)
|
|
11030
10915
|
};
|
|
11031
10916
|
// src/app/presets/features/audit-workflows/model/rules/unpinned-images-candidates.ts
|
|
11032
|
-
const SINGLE$
|
|
10917
|
+
const SINGLE$15 = 1;
|
|
11033
10918
|
const concrete = (image, location, related) => {
|
|
11034
10919
|
if (String$1.isEmpty(image.image) || Option.isSome(image.hash)) return Option.none();
|
|
11035
10920
|
const [annotation, level] = Option.match(image.tag, {
|
|
@@ -11086,7 +10971,7 @@ const candidatesOf = (matrix) => ([image, location]) => {
|
|
|
11086
10971
|
onNone: () => [opaque(location, [])],
|
|
11087
10972
|
onSome: (parsed) => {
|
|
11088
10973
|
const leaves = leafExpressions(parsed);
|
|
11089
|
-
const single = leaves.length === SINGLE$
|
|
10974
|
+
const single = leaves.length === SINGLE$15;
|
|
11090
10975
|
return pipe(leaves, Array$1.flatMap((leaf) => forLeaf(leaf, leafLocation(single, location)(leaf), matrix)));
|
|
11091
10976
|
}
|
|
11092
10977
|
});
|
|
@@ -11317,7 +11202,7 @@ const PUBLISHERS = [
|
|
|
11317
11202
|
...fixedAll(DEPLOYERS)
|
|
11318
11203
|
];
|
|
11319
11204
|
// src/app/presets/features/audit-workflows/model/rules/cache-poisoning-control.ts
|
|
11320
|
-
const TAG_PUSH_GUARD = Result.getOrThrow(parseExpression
|
|
11205
|
+
const TAG_PUSH_GUARD = Result.getOrThrow(parseExpression("github.event_name == 'push' && github.ref_type == 'tag'")).expr;
|
|
11321
11206
|
const TAG = { type: "tag" };
|
|
11322
11207
|
const TAG_PREFIX = "refs/tags/";
|
|
11323
11208
|
const STARTSWITH_ARGS = 2;
|
|
@@ -11594,7 +11479,7 @@ const jobVerdict = (permissions, explicitParent, location) => {
|
|
|
11594
11479
|
], () => !explicitParent);
|
|
11595
11480
|
return Option.some(baseVerdict(permissions.base, location));
|
|
11596
11481
|
};
|
|
11597
|
-
const SINGLE$
|
|
11482
|
+
const SINGLE$14 = 1;
|
|
11598
11483
|
const personaFor = (pedantic) => Boolean$1.match(pedantic, {
|
|
11599
11484
|
onTrue: () => "pedantic",
|
|
11600
11485
|
onFalse: () => "regular"
|
|
@@ -11606,7 +11491,7 @@ const excessivePermissions = {
|
|
|
11606
11491
|
const allExplicit = pipe(jobs, Array$1.every((job) => !isDefault(job.job.model.permissions)));
|
|
11607
11492
|
const explicitParent = !isDefault(workflow.model.permissions);
|
|
11608
11493
|
const reusableOnly = isReusableOnly(workflow);
|
|
11609
|
-
const workflowPersona = personaFor(workflow.model.jobs.length === SINGLE$
|
|
11494
|
+
const workflowPersona = personaFor(workflow.model.jobs.length === SINGLE$14 || allExplicit || reusableOnly);
|
|
11610
11495
|
const workflowAt = primary(workflowLocation(workflow));
|
|
11611
11496
|
const own = Array$1.map(workflowVerdicts(workflow.model.permissions, workflowAt), ([level, certainty, location]) => pipe(finding(meta$3), severity(level), confidence(certainty), persona(workflowPersona), at$2(location)));
|
|
11612
11497
|
const perJob = pipe(jobs, Array$1.flatMap((job) => {
|
|
@@ -11835,6 +11720,211 @@ const rulesOf = (audits) => {
|
|
|
11835
11720
|
};
|
|
11836
11721
|
const zizmorPlugin = definePlugin({ rules: rulesOf(AUDITS) });
|
|
11837
11722
|
const ZIZMOR_CONCERNS = pipe(CONCERNS, Record.map(identsOf));
|
|
11723
|
+
// src/app/presets/shared/project-cache/index.ts
|
|
11724
|
+
const projectCache = () => {
|
|
11725
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
11726
|
+
const entriesOf = (project) => cache.getOrInsertComputed(project, () => /* @__PURE__ */ new Map());
|
|
11727
|
+
return {
|
|
11728
|
+
get: (project) => (key) => Option.fromNullishOr(entriesOf(project).get(key)),
|
|
11729
|
+
set: (project) => (key, value) => {
|
|
11730
|
+
entriesOf(project).set(key, value);
|
|
11731
|
+
}
|
|
11732
|
+
};
|
|
11733
|
+
};
|
|
11734
|
+
// src/app/presets/shared/uses/index.ts
|
|
11735
|
+
const LOCAL = "./";
|
|
11736
|
+
const SELF_REPOSITORY = "$/";
|
|
11737
|
+
const localPath = (spec) => Option.orElse(afterPrefix(LOCAL)(spec), () => afterPrefix(SELF_REPOSITORY)(spec));
|
|
11738
|
+
const isSelfReferenceWithRef = (spec) => Option.exists(afterPrefix(SELF_REPOSITORY)(spec), String$1.includes("@"));
|
|
11739
|
+
const selfReferenceError = (spec) => `self repository reference ${quote(spec)} must not include @{ref}. "$/" always resolves to the commit of the running workflow. see https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsuses`;
|
|
11740
|
+
// src/app/presets/entities/workflow/model/reusable.ts
|
|
11741
|
+
const EMPTY_METADATA = {
|
|
11742
|
+
inputs: {},
|
|
11743
|
+
outputs: {},
|
|
11744
|
+
secrets: {}
|
|
11745
|
+
};
|
|
11746
|
+
// src/app/presets/entities/workflow/lib/reusable-sections.ts
|
|
11747
|
+
const KINDS = {
|
|
11748
|
+
boolean: "boolean",
|
|
11749
|
+
number: "number",
|
|
11750
|
+
string: "string"
|
|
11751
|
+
};
|
|
11752
|
+
const fieldsOf$2 = (sink, node) => ({
|
|
11753
|
+
required: flagAt(sink)("required")(node),
|
|
11754
|
+
defaulted: Option.exists(valueAt("default")(node), (value) => Option.isSome(decodeOptionalString(sink)(value))),
|
|
11755
|
+
type: Option.match(valueAt("type")(node), {
|
|
11756
|
+
onNone: () => "",
|
|
11757
|
+
onSome: decodeString(sink)
|
|
11758
|
+
})
|
|
11759
|
+
});
|
|
11760
|
+
const inputOf$1 = (sink) => (name, node) => {
|
|
11761
|
+
if (isNull(node)) return Option.some({
|
|
11762
|
+
name,
|
|
11763
|
+
required: false,
|
|
11764
|
+
kind: "any"
|
|
11765
|
+
});
|
|
11766
|
+
if (node.kind !== "mapping") {
|
|
11767
|
+
typeError(sink)(node, "actionlint.metadata");
|
|
11768
|
+
return Option.none();
|
|
11769
|
+
}
|
|
11770
|
+
let failed = false;
|
|
11771
|
+
const fields = fieldsOf$2((message) => {
|
|
11772
|
+
failed = true;
|
|
11773
|
+
sink(message);
|
|
11774
|
+
}, node);
|
|
11775
|
+
return pipe(Option.liftPredicate(fields, () => !failed), Option.map((found) => ({
|
|
11776
|
+
name,
|
|
11777
|
+
required: found.required && !found.defaulted,
|
|
11778
|
+
kind: Option.getOrElse(Record.get(KINDS, found.type), () => "any")
|
|
11779
|
+
})));
|
|
11780
|
+
};
|
|
11781
|
+
const inputsOf$1 = (sink) => (node) => {
|
|
11782
|
+
let out = {};
|
|
11783
|
+
if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.inputs")) return out;
|
|
11784
|
+
for (const { key, value } of pairsOf(node)) {
|
|
11785
|
+
const input = inputOf$1(sink)(key.value, value);
|
|
11786
|
+
if (Option.isNone(input)) return out;
|
|
11787
|
+
out = Record.set(out, lowerKey(key), input.value);
|
|
11788
|
+
}
|
|
11789
|
+
return out;
|
|
11790
|
+
};
|
|
11791
|
+
const secretRequired = (sink, node) => {
|
|
11792
|
+
if (!isPresent(sink)(node, "mapping", "actionlint.ReusableWorkflowMetadataSecret")) return Option.liftPredicate(false, () => isNull(node));
|
|
11793
|
+
let required = false;
|
|
11794
|
+
let failed = false;
|
|
11795
|
+
const local = (message) => {
|
|
11796
|
+
failed = true;
|
|
11797
|
+
sink(message);
|
|
11798
|
+
};
|
|
11799
|
+
for (const { key, value } of pairsOf(node)) if (key.value === "required") required = decodeBoolean(local)(value);
|
|
11800
|
+
return Option.liftPredicate(required, () => !failed);
|
|
11801
|
+
};
|
|
11802
|
+
const secretsOf = (sink) => (node) => {
|
|
11803
|
+
let out = {};
|
|
11804
|
+
if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.secrets")) return out;
|
|
11805
|
+
for (const { key, value } of pairsOf(node)) {
|
|
11806
|
+
const required = secretRequired(sink, value);
|
|
11807
|
+
if (Option.isNone(required)) return out;
|
|
11808
|
+
out = Record.set(out, lowerKey(key), {
|
|
11809
|
+
name: key.value,
|
|
11810
|
+
required: required.value
|
|
11811
|
+
});
|
|
11812
|
+
}
|
|
11813
|
+
return out;
|
|
11814
|
+
};
|
|
11815
|
+
const outputsOf$1 = (sink) => (node) => {
|
|
11816
|
+
if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.outputs")) return {};
|
|
11817
|
+
return Record.fromEntries(pipe(pairsOf(node), Array$1.map(({ key }) => [lowerKey(key), key.value])));
|
|
11818
|
+
};
|
|
11819
|
+
// src/app/presets/entities/workflow/lib/reusable.ts
|
|
11820
|
+
const CALL = "workflow_call";
|
|
11821
|
+
const isCall = (node) => String$1.toLowerCase(node.value) === CALL;
|
|
11822
|
+
const metadataOf$2 = (sink, node) => {
|
|
11823
|
+
if (!isPresent(sink)(node, "mapping", "actionlint.ReusableWorkflowMetadata")) return EMPTY_METADATA;
|
|
11824
|
+
const section = (key) => valueAt(key)(node);
|
|
11825
|
+
return {
|
|
11826
|
+
inputs: pipe(section("inputs"), Option.map(inputsOf$1(sink)), Option.getOrElse(() => ({}))),
|
|
11827
|
+
outputs: pipe(section("outputs"), Option.map(outputsOf$1(sink)), Option.getOrElse(() => ({}))),
|
|
11828
|
+
secrets: pipe(section("secrets"), Option.map(secretsOf(sink)), Option.getOrElse(() => ({})))
|
|
11829
|
+
};
|
|
11830
|
+
};
|
|
11831
|
+
const decodeCall = (node) => {
|
|
11832
|
+
const errors = [];
|
|
11833
|
+
const metadata = metadataOf$2((message) => {
|
|
11834
|
+
errors.push(message);
|
|
11835
|
+
}, node);
|
|
11836
|
+
if (Array$1.isReadonlyArrayEmpty(errors)) return Result.succeed(metadata);
|
|
11837
|
+
return Result.fail(`yaml: unmarshal errors:\n ${Array$1.join(errors, "\n ")}`);
|
|
11838
|
+
};
|
|
11839
|
+
const fromOn = (on) => {
|
|
11840
|
+
const call = pipe(pairsOf(on), Array$1.findFirst((pair) => isCall(pair.key)));
|
|
11841
|
+
if (on.kind === "mapping" && Option.isSome(call)) return decodeCall(call.value.value);
|
|
11842
|
+
if (on.kind === "scalar" && isCall(on) || on.kind === "sequence" && pipe(on.children, Array$1.some(isCall))) return Result.succeed(EMPTY_METADATA);
|
|
11843
|
+
return Result.fail(`"workflow_call" event trigger is not found in "on:" at line:${String(on.line)}, column:${String(on.column)}`);
|
|
11844
|
+
};
|
|
11845
|
+
const reusableOf = readYaml((source) => {
|
|
11846
|
+
const on = pipe(Option.fromNullishOr(source.yaml), Option.filter((root) => root.kind === "mapping"), Option.flatMap(valueAt("on")));
|
|
11847
|
+
if (Option.isNone(on)) return Result.fail("\"on:\" is not found");
|
|
11848
|
+
return fromOn(on.value);
|
|
11849
|
+
});
|
|
11850
|
+
// src/app/presets/entities/workflow/lib/local-workflows.ts
|
|
11851
|
+
const reusables = projectCache();
|
|
11852
|
+
const unreadable = (spec, relative) => Result.fail(`could not read reusable workflow file for ${quote(spec)}: open ${relative}: no such file or directory`);
|
|
11853
|
+
const load$1 = (project, spec, relative) => Option.match(project.parse(relative), {
|
|
11854
|
+
onNone: () => unreadable(spec, relative),
|
|
11855
|
+
onSome: (source) => Result.mapError(reusableOf(source), (message) => `error while parsing reusable workflow ${quote(spec)}: ${String$1.replaceAll("\n", " ")(message)}`)
|
|
11856
|
+
});
|
|
11857
|
+
const findReusable = (project) => (spec) => {
|
|
11858
|
+
const relative = Option.filter(localPath(spec), () => !containsExpression(spec));
|
|
11859
|
+
if (Option.isNone(relative)) return Option.none();
|
|
11860
|
+
const hit = reusables.get(project)(spec);
|
|
11861
|
+
if (Option.isSome(hit)) return hit.value;
|
|
11862
|
+
const loaded = Option.some(load$1(project, spec, relative.value));
|
|
11863
|
+
reusables.set(project)(spec, pipe(loaded, Option.filter((found) => Result.isSuccess(found))));
|
|
11864
|
+
return loaded;
|
|
11865
|
+
};
|
|
11866
|
+
const skipReusable = (project) => (spec) => {
|
|
11867
|
+
reusables.set(project)(spec, Option.none());
|
|
11868
|
+
};
|
|
11869
|
+
// src/app/presets/entities/workflow/lib/raw-compare.ts
|
|
11870
|
+
const sameProps = (compare, mine, theirs) => Record.size(mine) === Record.size(theirs) && pipe(Record.toEntries(mine), Array$1.every(([name, value]) => Option.exists(Record.get(theirs, name), (other) => compare(value)(other))));
|
|
11871
|
+
const sameElems = (compare, mine, theirs) => mine.length === theirs.length && pipe(Array$1.zip(mine, theirs), Array$1.every(([left, right]) => compare(left)(right)));
|
|
11872
|
+
const rawEquals = (left) => (right) => {
|
|
11873
|
+
if (left.type === "object" && right.type === "object") return sameProps(rawEquals, left.props, right.props);
|
|
11874
|
+
if (left.type === "array" && right.type === "array") return sameElems(rawEquals, left.elems, right.elems);
|
|
11875
|
+
return left.type === "string" && right.type === "string" && left.value === right.value;
|
|
11876
|
+
};
|
|
11877
|
+
const rawDescribe = (value) => {
|
|
11878
|
+
if (value.type === "object") {
|
|
11879
|
+
const parts = pipe(Record.toEntries(value.props), Array$1.map(([name, prop]) => `${quote(name)}: ${rawDescribe(prop)}`));
|
|
11880
|
+
return `{${Array$1.join(Array$1.sort(parts, Order.String), ", ")}}`;
|
|
11881
|
+
}
|
|
11882
|
+
if (value.type === "array") return `[${pipe(value.elems, Array$1.map(rawDescribe), Array$1.join(", "))}]`;
|
|
11883
|
+
return quote(value.value);
|
|
11884
|
+
};
|
|
11885
|
+
const isExpression = (value) => value.type === "string" && containsExpression(value.value);
|
|
11886
|
+
const objectSubset = (compare, value, sub) => value.type === "object" && sub.type === "object" && pipe(Record.toEntries(sub.props), Array$1.every(([name, each]) => Option.exists(Record.get(value.props, name), (prop) => compare(prop)(each))));
|
|
11887
|
+
const isSubset = (value) => (sub) => {
|
|
11888
|
+
if (isExpression(sub)) return true;
|
|
11889
|
+
if (value.type === "object") return objectSubset(isSubset, value, sub);
|
|
11890
|
+
if (value.type === "array") return sub.type === "array" && sameElems(isSubset, value.elems, sub.elems);
|
|
11891
|
+
return containsExpression(value.value) || rawEquals(value)(sub);
|
|
11892
|
+
};
|
|
11893
|
+
// src/app/presets/features/check-practices/model/full-history-checkout.ts
|
|
11894
|
+
const DEPTH = "fetch-depth";
|
|
11895
|
+
const WHOLE_HISTORY = "0";
|
|
11896
|
+
/** @internal */
|
|
11897
|
+
const fullHistoryCheckout = workflowRule({
|
|
11898
|
+
description: "Reports fetch-depth: 0, because the whole history is downloaded on every run and grows with the repository",
|
|
11899
|
+
docs: "https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches",
|
|
11900
|
+
visitor: (fail) => ({
|
|
11901
|
+
...NOOP,
|
|
11902
|
+
step: (step) => {
|
|
11903
|
+
const depths = pipe(actionOf(step), Option.flatMap(({ inputs }) => Option.fromNullishOr(inputs)), Option.flatMap(Record.get(DEPTH)), Option.filter((input) => input.value.value === WHOLE_HISTORY), Option.toArray);
|
|
11904
|
+
for (const input of depths) fail(input.name, "fetches the whole history with `fetch-depth: 0`. The download grows with the repository on every run. Fetch only the commits the job reads.");
|
|
11905
|
+
}
|
|
11906
|
+
})
|
|
11907
|
+
});
|
|
11908
|
+
// src/app/presets/features/check-practices/model/workflow-cancel.ts
|
|
11909
|
+
const PUSH = "push";
|
|
11910
|
+
/** @internal */
|
|
11911
|
+
const workflowCancel = workflowRule({
|
|
11912
|
+
description: "Reports cancel-in-progress on the concurrency of a workflow that a push starts, because a newer push then stops a deploy that is running and leaves it half done",
|
|
11913
|
+
docs: "https://docs.github.com/en/actions/using-jobs/using-concurrency",
|
|
11914
|
+
visitor: (fail) => ({
|
|
11915
|
+
...NOOP,
|
|
11916
|
+
workflowPre: (workflow) => {
|
|
11917
|
+
const pushed = pipe(Option.fromNullishOr(workflow.on), Option.getOrElse(() => []), Array$1.some((event) => event.type === "webhook" && event.hook.value === PUSH));
|
|
11918
|
+
const cancels = pipe(Option.fromNullishOr(workflow.concurrency), Option.flatMap(({ cancelInProgress }) => Option.fromNullishOr(cancelInProgress)), Option.filter(({ value }) => pushed && value), Option.toArray);
|
|
11919
|
+
for (const found of cancels) fail(found, "cancels in progress for the whole workflow that a push starts. A newer push then stops a deploy that is running and leaves it half done. Put `cancel-in-progress: true` on the `concurrency` of the jobs that a later push redoes, and leave the deploy and release jobs on the default.");
|
|
11920
|
+
}
|
|
11921
|
+
})
|
|
11922
|
+
});
|
|
11923
|
+
// src/app/presets/features/check-practices/index.ts
|
|
11924
|
+
const practicesPlugin = definePlugin({ rules: {
|
|
11925
|
+
"workflow-cancel": workflowCancel,
|
|
11926
|
+
"full-history-checkout": fullHistoryCheckout
|
|
11927
|
+
} });
|
|
11838
11928
|
// src/app/presets/features/check-workflows/lib/settings.ts
|
|
11839
11929
|
const Names = Schema.String.pipe(Schema.Array, Schema.NullOr);
|
|
11840
11930
|
const Runner = Schema.Struct({ labels: Schema.optional(Names) });
|
|
@@ -11843,15 +11933,15 @@ const ActionlintSettings = Schema.Struct({
|
|
|
11843
11933
|
"config-variables": Schema.optional(Names)
|
|
11844
11934
|
});
|
|
11845
11935
|
const decode = Schema.decodeUnknownOption(ActionlintSettings);
|
|
11846
|
-
const parsed$
|
|
11847
|
-
const parse$
|
|
11936
|
+
const parsed$1 = /* @__PURE__ */ new WeakMap();
|
|
11937
|
+
const parse$1 = (raw) => {
|
|
11848
11938
|
const found = pipe(Record.get(raw, "actionlint"), Option.flatMap(decode));
|
|
11849
11939
|
return {
|
|
11850
11940
|
runnerLabels: pipe(found, Option.flatMap((settings) => Option.fromNullishOr(settings["self-hosted-runner"])), Option.flatMap((runner) => Option.fromNullishOr(runner.labels)), Option.getOrElse(() => [])),
|
|
11851
11941
|
configVariables: pipe(found, Option.flatMap((settings) => Option.fromNullishOr(settings["config-variables"])))
|
|
11852
11942
|
};
|
|
11853
11943
|
};
|
|
11854
|
-
const settingsOf = (context) => parsed$
|
|
11944
|
+
const settingsOf = (context) => parsed$1.getOrInsertComputed(context.settings, () => parse$1(context.settings));
|
|
11855
11945
|
// src/app/presets/entities/expression/model/ast.ts
|
|
11856
11946
|
const tokenOf = (expr) => {
|
|
11857
11947
|
if (expr.type === "object-deref" || expr.type === "array-deref") return tokenOf(expr.receiver);
|
|
@@ -11866,15 +11956,15 @@ const NULL = { kind: "null" };
|
|
|
11866
11956
|
const NUMBER$1 = { kind: "number" };
|
|
11867
11957
|
const BOOL = { kind: "bool" };
|
|
11868
11958
|
const STRING = { kind: "string" };
|
|
11869
|
-
const EMPTY
|
|
11959
|
+
const EMPTY = Record.empty();
|
|
11870
11960
|
const objectOf = (props) => (mapped) => ({
|
|
11871
11961
|
kind: "object",
|
|
11872
11962
|
props,
|
|
11873
11963
|
mapped
|
|
11874
11964
|
});
|
|
11875
|
-
const strict = (props = EMPTY
|
|
11876
|
-
const loose = (props = EMPTY
|
|
11877
|
-
const mapOf = (elem) => objectOf(EMPTY
|
|
11965
|
+
const strict = (props = EMPTY) => objectOf(props)(Option.none());
|
|
11966
|
+
const loose = (props = EMPTY) => objectOf(props)(Option.some(ANY));
|
|
11967
|
+
const mapOf = (elem) => objectOf(EMPTY)(Option.some(elem));
|
|
11878
11968
|
const arrayOf = (elem) => ({
|
|
11879
11969
|
kind: "array",
|
|
11880
11970
|
elem,
|
|
@@ -12425,8 +12515,8 @@ const KEYS = {
|
|
|
12425
12515
|
}
|
|
12426
12516
|
};
|
|
12427
12517
|
const workflowKey = (key) => Record.get(KEYS, key);
|
|
12428
|
-
const byKey
|
|
12429
|
-
const SPECIAL = pipe(Array$1.sort(Record.toEntries(KEYS), byKey
|
|
12518
|
+
const byKey = Order.mapInput(Order.String, ([key]) => key);
|
|
12519
|
+
const SPECIAL = pipe(Array$1.sort(Record.toEntries(KEYS), byKey), Array$1.flatMap(([key, found]) => pipe(found.functions, Array$1.map((name) => [name, key]))), Array$1.groupBy(([name]) => name), Record.map((pairs) => pipe(pairs, Array$1.map(([, key]) => key))));
|
|
12430
12520
|
// src/app/presets/entities/expression/lib/check-array-deref.ts
|
|
12431
12521
|
const DEREF_ANY = filteredOf(ANY);
|
|
12432
12522
|
const fromMapped = (scope, expr) => (object, mapped) => {
|
|
@@ -12489,7 +12579,7 @@ const ofJson = (value) => {
|
|
|
12489
12579
|
};
|
|
12490
12580
|
// src/app/presets/entities/expression/lib/format-placeholders.ts
|
|
12491
12581
|
const NEXT$11 = 1;
|
|
12492
|
-
const FIRST$
|
|
12582
|
+
const FIRST$4 = 0;
|
|
12493
12583
|
const ODD = 2;
|
|
12494
12584
|
const DIGIT$1 = /^\d$/u;
|
|
12495
12585
|
const NUMBER = /^\d+$/u;
|
|
@@ -12551,7 +12641,7 @@ const formatPlaceholders = (format) => {
|
|
|
12551
12641
|
const chars = codePoints(format);
|
|
12552
12642
|
const found = /* @__PURE__ */ new Set();
|
|
12553
12643
|
let scan = IDLE$1;
|
|
12554
|
-
for (let index = FIRST$
|
|
12644
|
+
for (let index = FIRST$4; index <= chars.length; index += NEXT$11) {
|
|
12555
12645
|
const next = step$2(chars, scan, index);
|
|
12556
12646
|
for (const value of Option.toArray(next.found)) found.add(value);
|
|
12557
12647
|
scan = next;
|
|
@@ -12561,7 +12651,7 @@ const formatPlaceholders = (format) => {
|
|
|
12561
12651
|
// src/app/presets/entities/expression/lib/json.ts
|
|
12562
12652
|
const OK = Option.none();
|
|
12563
12653
|
const NEXT$10 = 1;
|
|
12564
|
-
const FIRST$
|
|
12654
|
+
const FIRST$3 = 0;
|
|
12565
12655
|
const HEX_DIGITS = 4;
|
|
12566
12656
|
const CONTROL_END = 32;
|
|
12567
12657
|
const SPACES = /* @__PURE__ */ new Set([
|
|
@@ -12649,7 +12739,7 @@ const escape = (scan) => {
|
|
|
12649
12739
|
if (at$1(scan, "u")) return unicode(scan);
|
|
12650
12740
|
return invalid(scan, "in string escape code");
|
|
12651
12741
|
};
|
|
12652
|
-
const isControl = (scan) => Option.exists(Option.flatMap(scan.peek(), String$1.codePointAt(FIRST$
|
|
12742
|
+
const isControl = (scan) => Option.exists(Option.flatMap(scan.peek(), String$1.codePointAt(FIRST$3)), (code) => code < CONTROL_END);
|
|
12653
12743
|
const stringStep = (scan) => {
|
|
12654
12744
|
if (Option.isNone(scan.peek()) || isControl(scan)) return Option.some(invalid(scan, "in string literal"));
|
|
12655
12745
|
if (at$1(scan, "\"")) {
|
|
@@ -12726,7 +12816,7 @@ const value = (scan) => {
|
|
|
12726
12816
|
};
|
|
12727
12817
|
const scannerOf = (text) => {
|
|
12728
12818
|
const bytes = new TextEncoder().encode(text);
|
|
12729
|
-
let position = FIRST$
|
|
12819
|
+
let position = FIRST$3;
|
|
12730
12820
|
return {
|
|
12731
12821
|
peek: () => pipe(Option.fromNullishOr(bytes[position]), Option.map((byte) => String.fromCodePoint(byte))),
|
|
12732
12822
|
skip: () => {
|
|
@@ -12762,12 +12852,12 @@ const checkFormat = (scope, call, format) => {
|
|
|
12762
12852
|
return call.ret;
|
|
12763
12853
|
};
|
|
12764
12854
|
const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
12765
|
-
const parsed
|
|
12855
|
+
const parsed = (call, text) => Option.match(decodeJson(text), {
|
|
12766
12856
|
onNone: () => call.ret,
|
|
12767
12857
|
onSome: ofJson
|
|
12768
12858
|
});
|
|
12769
12859
|
const checkFromJson = (scope, call, { literal, text }) => Option.match(checkJson(text), {
|
|
12770
|
-
onNone: () => parsed
|
|
12860
|
+
onNone: () => parsed(call, text),
|
|
12771
12861
|
onSome: (error) => {
|
|
12772
12862
|
scope.fail(literal, `broken JSON string is passed to fromJSON() at offset ${String(error.offset)}: ${error.message}`);
|
|
12773
12863
|
return call.ret;
|
|
@@ -13055,10 +13145,10 @@ const LITERALS$1 = {
|
|
|
13055
13145
|
float: NUMBER$1
|
|
13056
13146
|
};
|
|
13057
13147
|
const NONE$9 = 0;
|
|
13058
|
-
const ONE$
|
|
13148
|
+
const ONE$2 = 1;
|
|
13059
13149
|
const contextNote = (contexts) => {
|
|
13060
13150
|
if (contexts.length === NONE$9) return "no context is available here";
|
|
13061
|
-
if (contexts.length === ONE$
|
|
13151
|
+
if (contexts.length === ONE$2) return `available context is ${quotes(contexts)}`;
|
|
13062
13152
|
return `available contexts are ${quotes(contexts)}`;
|
|
13063
13153
|
};
|
|
13064
13154
|
const checkContext = (scope, expr, name) => {
|
|
@@ -13275,7 +13365,7 @@ const SAFE = /* @__PURE__ */ new Set([
|
|
|
13275
13365
|
]);
|
|
13276
13366
|
const STEP = 1;
|
|
13277
13367
|
const NONE$8 = 0;
|
|
13278
|
-
const SINGLE$
|
|
13368
|
+
const SINGLE$13 = 1;
|
|
13279
13369
|
const IDLE = {
|
|
13280
13370
|
filtering: false,
|
|
13281
13371
|
cur: [],
|
|
@@ -13283,7 +13373,7 @@ const IDLE = {
|
|
|
13283
13373
|
};
|
|
13284
13374
|
const isSafeCall = (expr) => expr.type === "call" && SAFE.has(String$1.toLowerCase(expr.callee));
|
|
13285
13375
|
const messageOf$1 = (inputs) => {
|
|
13286
|
-
if (inputs.length === SINGLE$
|
|
13376
|
+
if (inputs.length === SINGLE$13) return `${quote(Array$1.join(inputs, ""))} is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. ${ADVICE}`;
|
|
13287
13377
|
return `object filter extracts potentially untrusted properties ${sortedQuotes(inputs)}. avoid using the value directly in inline scripts. instead, pass the value through an environment variable. ${ADVICE}`;
|
|
13288
13378
|
};
|
|
13289
13379
|
const ended = (walk) => {
|
|
@@ -13606,7 +13696,7 @@ const parseFloat = (stream) => {
|
|
|
13606
13696
|
stream.fail(`parsing invalid float literal ${quote(text)}: strconv.ParseFloat: parsing ${quote(text)}: value out of range`);
|
|
13607
13697
|
return Option.none();
|
|
13608
13698
|
};
|
|
13609
|
-
const parseString
|
|
13699
|
+
const parseString = (stream) => {
|
|
13610
13700
|
const token = stream.next();
|
|
13611
13701
|
const inner = String$1.replaceAll(STRING_DELIMITERS, "")(token.value);
|
|
13612
13702
|
return Option.some({
|
|
@@ -13620,31 +13710,31 @@ const PARSERS = {
|
|
|
13620
13710
|
"(": parseNested,
|
|
13621
13711
|
INTEGER: () => parseInt,
|
|
13622
13712
|
FLOAT: () => parseFloat,
|
|
13623
|
-
STRING: () => parseString
|
|
13713
|
+
STRING: () => parseString
|
|
13624
13714
|
};
|
|
13625
13715
|
const parsePrimary = (parseOr) => (stream) => pipe(Record.get(PARSERS, stream.peek()), Option.match({
|
|
13626
13716
|
onNone: () => unexpected$2(stream)("variable access, function call, null, bool, int, float or string", PRIMARY),
|
|
13627
13717
|
onSome: (parser) => parser(parseOr)(stream)
|
|
13628
13718
|
}));
|
|
13629
13719
|
// src/app/presets/entities/expression/lib/cursor.ts
|
|
13630
|
-
const FIRST$
|
|
13720
|
+
const FIRST$2 = 1;
|
|
13631
13721
|
const NEWLINE$1 = "\n";
|
|
13632
13722
|
const ORIGIN$1 = {
|
|
13633
13723
|
offset: 0,
|
|
13634
|
-
line: FIRST$
|
|
13635
|
-
column: FIRST$
|
|
13724
|
+
line: FIRST$2,
|
|
13725
|
+
column: FIRST$2
|
|
13636
13726
|
};
|
|
13637
13727
|
const peek = (src) => (at) => pipe(String$1.codePointAt(at.offset)(src), Option.map((point) => String.fromCodePoint(point)));
|
|
13638
13728
|
const after$2 = (at, char) => {
|
|
13639
13729
|
if (char === NEWLINE$1) return {
|
|
13640
13730
|
offset: at.offset + char.length,
|
|
13641
|
-
line: at.line + FIRST$
|
|
13642
|
-
column: FIRST$
|
|
13731
|
+
line: at.line + FIRST$2,
|
|
13732
|
+
column: FIRST$2
|
|
13643
13733
|
};
|
|
13644
13734
|
return {
|
|
13645
13735
|
offset: at.offset + char.length,
|
|
13646
13736
|
line: at.line,
|
|
13647
|
-
column: at.column + FIRST$
|
|
13737
|
+
column: at.column + FIRST$2
|
|
13648
13738
|
};
|
|
13649
13739
|
};
|
|
13650
13740
|
const advance$2 = (src) => (at) => pipe(peek(src)(at), Option.match({
|
|
@@ -13790,7 +13880,7 @@ const lexNum = (scan) => {
|
|
|
13790
13880
|
const ALPHA = "'a'..'z', 'A'..'Z', '_'";
|
|
13791
13881
|
const WHITE = /^[\t\n\r ]$/u;
|
|
13792
13882
|
const QUOTE$3 = "'";
|
|
13793
|
-
const SINGLE$
|
|
13883
|
+
const SINGLE$12 = {
|
|
13794
13884
|
"(": "(",
|
|
13795
13885
|
")": ")",
|
|
13796
13886
|
"[": "[",
|
|
@@ -13868,7 +13958,7 @@ const lexPair = (scan, pair) => {
|
|
|
13868
13958
|
}));
|
|
13869
13959
|
};
|
|
13870
13960
|
const lexPunct = (scan, char) => {
|
|
13871
|
-
const single = Record.get(SINGLE$
|
|
13961
|
+
const single = Record.get(SINGLE$12, char);
|
|
13872
13962
|
if (Option.isSome(single)) return finished(scan)(single.value, advance$2(scan.src)(scan.start));
|
|
13873
13963
|
return pipe(Record.get(PAIRS, char), Option.match({
|
|
13874
13964
|
onNone: () => unexpected$1(scan)({
|
|
@@ -14045,1595 +14135,13 @@ const outcome = (stream, root) => {
|
|
|
14045
14135
|
if (stream.peek() !== "END") return Result.fail(remaining(stream));
|
|
14046
14136
|
return Result.succeed(root.value);
|
|
14047
14137
|
};
|
|
14048
|
-
const parse
|
|
14138
|
+
const parse = (src) => {
|
|
14049
14139
|
const stream = streamOf(src);
|
|
14050
14140
|
return {
|
|
14051
14141
|
result: outcome(stream, parseOr(stream)),
|
|
14052
14142
|
offset: stream.offset()
|
|
14053
14143
|
};
|
|
14054
14144
|
};
|
|
14055
|
-
// src/app/presets/entities/workflow/lib/expression-text.ts
|
|
14056
|
-
const OPEN$3 = "${{";
|
|
14057
|
-
const CLOSE$2 = "}}";
|
|
14058
|
-
const SINGLE$12 = 2;
|
|
14059
|
-
const containsExpression = (text) => Option.match(Option.all([String$1.indexOf(OPEN$3)(text), String$1.indexOf(CLOSE$2)(text)]), {
|
|
14060
|
-
onNone: () => false,
|
|
14061
|
-
onSome: ([open, close]) => open < close
|
|
14062
|
-
});
|
|
14063
|
-
const isExpressionAssigned = (text) => {
|
|
14064
|
-
const trimmed = String$1.trim(text);
|
|
14065
|
-
return String$1.startsWith(OPEN$3)(trimmed) && String$1.endsWith(CLOSE$2)(trimmed) && String$1.split(OPEN$3)(trimmed).length === SINGLE$12;
|
|
14066
|
-
};
|
|
14067
|
-
// src/app/presets/shared/record/optional.ts
|
|
14068
|
-
const optional = (key) => (value) => Option.match(value, {
|
|
14069
|
-
onNone: () => ({}),
|
|
14070
|
-
onSome: (present) => Record.singleton(key, present)
|
|
14071
|
-
});
|
|
14072
|
-
// src/app/presets/entities/workflow/lib/scalar.ts
|
|
14073
|
-
const ZERO$1 = 0;
|
|
14074
|
-
const FLOAT_TAGS = /* @__PURE__ */ new Set([
|
|
14075
|
-
"!!float",
|
|
14076
|
-
"!!int",
|
|
14077
|
-
"!!str"
|
|
14078
|
-
]);
|
|
14079
|
-
const nodeShape = (node) => `${node.kind} node with ${quote(node.tag)} tag`;
|
|
14080
|
-
const emptyText = (node) => ({
|
|
14081
|
-
value: "",
|
|
14082
|
-
quoted: false,
|
|
14083
|
-
line: node.line,
|
|
14084
|
-
column: node.column
|
|
14085
|
-
});
|
|
14086
|
-
const checkString$1 = (sink) => (node, allowEmpty) => {
|
|
14087
|
-
if (node.kind !== "scalar") {
|
|
14088
|
-
sink.error(node, `expected scalar node for string value but found ${nodeShape(node)}`);
|
|
14089
|
-
return false;
|
|
14090
|
-
}
|
|
14091
|
-
if (!allowEmpty && node.value === "") {
|
|
14092
|
-
sink.error(node, "string should not be empty");
|
|
14093
|
-
return false;
|
|
14094
|
-
}
|
|
14095
|
-
return true;
|
|
14096
|
-
};
|
|
14097
|
-
const parseString = (sink) => (node, allowEmpty) => {
|
|
14098
|
-
if (!checkString$1(sink)(node, allowEmpty)) return emptyText(node);
|
|
14099
|
-
return textOf$2(node);
|
|
14100
|
-
};
|
|
14101
|
-
const parseExpression = (sink) => (node, expecting) => {
|
|
14102
|
-
if (!isExpressionAssigned(node.value)) {
|
|
14103
|
-
sink.error(node, `expecting a single \${{...}} expression or ${expecting}, but found plain text node`);
|
|
14104
|
-
return Option.none();
|
|
14105
|
-
}
|
|
14106
|
-
return Option.some(textOf$2(node));
|
|
14107
|
-
};
|
|
14108
|
-
const mayParseExpression = (node) => pipe(Option.liftPredicate(node, (value) => value.tag === "!!str" && isExpressionAssigned(value.value)), Option.map(textOf$2));
|
|
14109
|
-
const parseBool = (sink) => (node) => {
|
|
14110
|
-
if (node.kind !== "scalar" || node.tag !== "!!bool" && node.tag !== "!!str") {
|
|
14111
|
-
sink.error(node, `expected bool value but found ${nodeShape(node)}`);
|
|
14112
|
-
return Option.none();
|
|
14113
|
-
}
|
|
14114
|
-
const at = {
|
|
14115
|
-
line: node.line,
|
|
14116
|
-
column: node.column
|
|
14117
|
-
};
|
|
14118
|
-
if (node.tag === "!!str") {
|
|
14119
|
-
const expression = parseExpression(sink)(node, "boolean literal \"true\" or \"false\"");
|
|
14120
|
-
return Option.some({
|
|
14121
|
-
...at,
|
|
14122
|
-
value: false,
|
|
14123
|
-
...optional("expression")(expression)
|
|
14124
|
-
});
|
|
14125
|
-
}
|
|
14126
|
-
return Option.some({
|
|
14127
|
-
...at,
|
|
14128
|
-
value: node.value === "true"
|
|
14129
|
-
});
|
|
14130
|
-
};
|
|
14131
|
-
const fromExpression$1 = (expression) => pipe(expression, Option.map((text) => ({
|
|
14132
|
-
value: ZERO$1,
|
|
14133
|
-
expression: text
|
|
14134
|
-
})));
|
|
14135
|
-
const integerLiteral = (sink) => (node) => {
|
|
14136
|
-
const parsed = atoi(node.value);
|
|
14137
|
-
if (typeof parsed === "string") {
|
|
14138
|
-
const shown = quote(node.value);
|
|
14139
|
-
sink.error(node, `invalid integer value: ${shown}: strconv.Atoi: parsing ${shown}: ${parsed}`);
|
|
14140
|
-
return Option.none();
|
|
14141
|
-
}
|
|
14142
|
-
return Option.some({ value: parsed });
|
|
14143
|
-
};
|
|
14144
|
-
const parseInteger = (sink) => (node) => {
|
|
14145
|
-
if (node.kind !== "scalar" || node.tag !== "!!int" && node.tag !== "!!str") {
|
|
14146
|
-
sink.error(node, `expected scalar node for integer value but found ${nodeShape(node)}`);
|
|
14147
|
-
return Option.none();
|
|
14148
|
-
}
|
|
14149
|
-
if (node.tag === "!!str") return fromExpression$1(parseExpression(sink)(node, "integer literal"));
|
|
14150
|
-
return integerLiteral(sink)(node);
|
|
14151
|
-
};
|
|
14152
|
-
const parseNumber$1 = (sink) => (node) => {
|
|
14153
|
-
if (node.kind !== "scalar" || !FLOAT_TAGS.has(node.tag)) {
|
|
14154
|
-
sink.error(node, `expected scalar node for float value but found ${nodeShape(node)}`);
|
|
14155
|
-
return Option.none();
|
|
14156
|
-
}
|
|
14157
|
-
if (node.tag === "!!str") return fromExpression$1(parseExpression(sink)(node, "float number literal"));
|
|
14158
|
-
const parsed = pipe(parseGoFloat(node.value), Option.filter((value) => !Number.isNaN(value)));
|
|
14159
|
-
if (Option.isNone(parsed)) {
|
|
14160
|
-
const shown = quote(node.value);
|
|
14161
|
-
sink.error(node, `invalid float value: ${shown}: strconv.ParseFloat: parsing ${shown}: invalid syntax`);
|
|
14162
|
-
}
|
|
14163
|
-
return pipe(parsed, Option.map((value) => ({ value })));
|
|
14164
|
-
};
|
|
14165
|
-
const parseTimeoutMinutes = (sink) => (node) => {
|
|
14166
|
-
const parsed = parseNumber$1(sink)(node);
|
|
14167
|
-
if (Option.isSome(parsed) && Predicate.isUndefined(parsed.value.expression) && parsed.value.value <= ZERO$1) sink.error(node, `value at "timeout-minutes" must be greater than zero: ${goFloat(parsed.value.value)}`);
|
|
14168
|
-
return parsed;
|
|
14169
|
-
};
|
|
14170
|
-
// src/app/presets/entities/workflow/lib/sequence.ts
|
|
14171
|
-
const EMPTY$1 = 0;
|
|
14172
|
-
const ONE$2 = 1;
|
|
14173
|
-
const sectionName = (section) => {
|
|
14174
|
-
if (String$1.includes(" ")(section)) return section;
|
|
14175
|
-
return `${quote(section)} section`;
|
|
14176
|
-
};
|
|
14177
|
-
const unexpectedMessage = (input) => {
|
|
14178
|
-
const section = sectionName(input.section);
|
|
14179
|
-
const key = quote(input.key.value);
|
|
14180
|
-
const [first] = input.expected;
|
|
14181
|
-
if (input.expected.length === ONE$2 && Predicate.isNotUndefined(first)) return `expected ${quote(first)} key for ${section} but got ${key}`;
|
|
14182
|
-
if (input.expected.length === EMPTY$1) return `unexpected key ${key} for ${section}`;
|
|
14183
|
-
return `unexpected key ${key} for ${section}. expected one of ${sortedQuotes(input.expected)}`;
|
|
14184
|
-
};
|
|
14185
|
-
const unexpectedKey = (sink) => (input) => {
|
|
14186
|
-
sink.error(input.key, unexpectedMessage(input));
|
|
14187
|
-
};
|
|
14188
|
-
const reportEmpty = (sink) => (section, node) => {
|
|
14189
|
-
sink.error(node, `${quote(section)} section should not be empty`);
|
|
14190
|
-
};
|
|
14191
|
-
const checkNotEmpty = (sink) => (section, node) => {
|
|
14192
|
-
if (node.children.length === EMPTY$1) {
|
|
14193
|
-
reportEmpty(sink)(section, node);
|
|
14194
|
-
return false;
|
|
14195
|
-
}
|
|
14196
|
-
return true;
|
|
14197
|
-
};
|
|
14198
|
-
const checkSequence$1 = (sink) => (input) => {
|
|
14199
|
-
const { node, section } = input;
|
|
14200
|
-
if (node.kind !== "sequence") {
|
|
14201
|
-
sink.error(node, `${quote(section)} section must be sequence node but got ${node.kind} node with ${quote(node.tag)} tag`);
|
|
14202
|
-
return false;
|
|
14203
|
-
}
|
|
14204
|
-
return input.allowEmpty || checkNotEmpty(sink)(section, node);
|
|
14205
|
-
};
|
|
14206
|
-
const parseStringSequence = (sink) => (input) => {
|
|
14207
|
-
if (!checkSequence$1(sink)(input)) return [];
|
|
14208
|
-
return pipe(input.node.children, Array$1.map((child) => parseString(sink)(child, input.allowElementEmpty)));
|
|
14209
|
-
};
|
|
14210
|
-
const parseStringOrSequence = (sink) => (input) => {
|
|
14211
|
-
const { node } = input;
|
|
14212
|
-
if (node.kind !== "scalar") return parseStringSequence(sink)(input);
|
|
14213
|
-
if (input.allowEmpty && node.tag === "!!null") return [];
|
|
14214
|
-
return [parseString(sink)(node, input.allowElementEmpty)];
|
|
14215
|
-
};
|
|
14216
|
-
// src/app/presets/entities/workflow/lib/fold.ts
|
|
14217
|
-
const foldEntries = (input) => {
|
|
14218
|
-
const table = Record.fromEntries(input.handlers);
|
|
14219
|
-
return Array$1.reduce(input.entries, input.initial, (state, entry) => Option.getOrElse(Record.get(table, entry.id), () => input.unknown)(state, entry));
|
|
14220
|
-
};
|
|
14221
|
-
const rejecting = (input) => (state, entry) => {
|
|
14222
|
-
unexpectedKey(input.sink)({
|
|
14223
|
-
key: entry.key,
|
|
14224
|
-
section: input.section,
|
|
14225
|
-
expected: input.expected
|
|
14226
|
-
});
|
|
14227
|
-
return state;
|
|
14228
|
-
};
|
|
14229
|
-
const setters = () => ({
|
|
14230
|
-
set: (key, parse) => (state, entry) => ({
|
|
14231
|
-
...state,
|
|
14232
|
-
[key]: parse(entry)
|
|
14233
|
-
}),
|
|
14234
|
-
setSome: (key, parse) => (state, entry) => Option.match(parse(entry), {
|
|
14235
|
-
onNone: () => state,
|
|
14236
|
-
onSome: (value) => ({
|
|
14237
|
-
...state,
|
|
14238
|
-
[key]: value
|
|
14239
|
-
})
|
|
14240
|
-
})
|
|
14241
|
-
});
|
|
14242
|
-
const keep = (state) => state;
|
|
14243
|
-
// ../lint-host/src/shared/lib/collections.ts
|
|
14244
|
-
const byKey = Order.mapInput(String$1.Order, ([key]) => key);
|
|
14245
|
-
const sortedRecord = (entries) => Record.fromEntries(Array$1.sort(entries, byKey));
|
|
14246
|
-
const ancestorsBy = (parentOf) => (node) => Array$1.unfold(parentOf(node), (current) => pipe(current, Option.map((found) => [found, parentOf(found)])));
|
|
14247
|
-
// src/app/presets/entities/workflow/lib/mapping.ts
|
|
14248
|
-
const MERGE_KEY = "<<";
|
|
14249
|
-
const EMPTY = 0;
|
|
14250
|
-
const emptyMessage = (place) => `${place} should not be empty. please remove this section if it's unnecessary`;
|
|
14251
|
-
const caseNote = (caseSensitive) => {
|
|
14252
|
-
if (caseSensitive) return "";
|
|
14253
|
-
return ". note that this key is case insensitive";
|
|
14254
|
-
};
|
|
14255
|
-
const duplicateMessage = (input, key, previous) => {
|
|
14256
|
-
const note = caseNote(input.caseSensitive);
|
|
14257
|
-
return `key ${quote(key.value)} is duplicated in ${input.place}. previously defined at ${describePosition(previous)}${note}`;
|
|
14258
|
-
};
|
|
14259
|
-
const idOf = (input, key) => {
|
|
14260
|
-
if (input.caseSensitive) return key.value;
|
|
14261
|
-
return String$1.toLowerCase(key.value);
|
|
14262
|
-
};
|
|
14263
|
-
const collectPair = (sink, input) => (collected, pair) => {
|
|
14264
|
-
const key = parseString(sink)(pair.key, false);
|
|
14265
|
-
const id = idOf(input, key);
|
|
14266
|
-
if (key.value === MERGE_KEY) {
|
|
14267
|
-
sink.error(key, `GitHub Actions does not support YAML merge key "${MERGE_KEY}"`);
|
|
14268
|
-
return collected;
|
|
14269
|
-
}
|
|
14270
|
-
return Option.match(Record.get(collected.seen, id), {
|
|
14271
|
-
onSome: (previous) => {
|
|
14272
|
-
sink.error(key, duplicateMessage(input, key, previous));
|
|
14273
|
-
return collected;
|
|
14274
|
-
},
|
|
14275
|
-
onNone: () => ({
|
|
14276
|
-
seen: {
|
|
14277
|
-
...collected.seen,
|
|
14278
|
-
[id]: key
|
|
14279
|
-
},
|
|
14280
|
-
entries: [...collected.entries, {
|
|
14281
|
-
id,
|
|
14282
|
-
key,
|
|
14283
|
-
value: pair.value
|
|
14284
|
-
}]
|
|
14285
|
-
})
|
|
14286
|
-
});
|
|
14287
|
-
};
|
|
14288
|
-
const nonMapping = (sink, input) => {
|
|
14289
|
-
const { node, place } = input;
|
|
14290
|
-
if (node.kind === "scalar" && node.tag === "!!null") {
|
|
14291
|
-
if (!input.allowEmpty) sink.error(node, emptyMessage(place));
|
|
14292
|
-
return true;
|
|
14293
|
-
}
|
|
14294
|
-
if (node.kind !== "mapping") {
|
|
14295
|
-
sink.error(node, `${place} is ${node.kind} node but mapping node is expected`);
|
|
14296
|
-
return true;
|
|
14297
|
-
}
|
|
14298
|
-
return false;
|
|
14299
|
-
};
|
|
14300
|
-
const parseMapping = (sink) => (input) => {
|
|
14301
|
-
if (nonMapping(sink, input)) return [];
|
|
14302
|
-
const { entries } = Array$1.reduce(pairsOf(input.node), {
|
|
14303
|
-
seen: {},
|
|
14304
|
-
entries: []
|
|
14305
|
-
}, collectPair(sink, input));
|
|
14306
|
-
if (!input.allowEmpty && entries.length === EMPTY) sink.error(input.node, emptyMessage(input.place));
|
|
14307
|
-
return entries;
|
|
14308
|
-
};
|
|
14309
|
-
const sectionWith = (flags) => (sink) => (section, node) => parseMapping(sink)({
|
|
14310
|
-
...flags,
|
|
14311
|
-
node,
|
|
14312
|
-
place: `${quote(section)} section`
|
|
14313
|
-
});
|
|
14314
|
-
const section$1 = sectionWith({
|
|
14315
|
-
allowEmpty: false,
|
|
14316
|
-
caseSensitive: true
|
|
14317
|
-
});
|
|
14318
|
-
const caselessSection = sectionWith({
|
|
14319
|
-
allowEmpty: false,
|
|
14320
|
-
caseSensitive: false
|
|
14321
|
-
});
|
|
14322
|
-
const emptyableSection = sectionWith({
|
|
14323
|
-
allowEmpty: true,
|
|
14324
|
-
caseSensitive: true
|
|
14325
|
-
});
|
|
14326
|
-
const emptyableCaselessSection = sectionWith({
|
|
14327
|
-
allowEmpty: true,
|
|
14328
|
-
caseSensitive: false
|
|
14329
|
-
});
|
|
14330
|
-
const entryText = (sink) => (allowEmpty) => (entry) => parseString(sink)(entry.value, allowEmpty);
|
|
14331
|
-
const entryRecord = (parse) => (entries) => sortedRecord(pipe(entries, Array$1.map((entry) => [entry.id, parse(entry)])));
|
|
14332
|
-
// src/app/presets/entities/workflow/lib/sink.ts
|
|
14333
|
-
const reportMissing = (sink) => (value, at, message) => {
|
|
14334
|
-
if (Predicate.isUndefined(value)) sink.error(at, message);
|
|
14335
|
-
};
|
|
14336
|
-
// src/app/presets/entities/workflow/lib/runner.ts
|
|
14337
|
-
const labels = (sink) => (name, node) => parseStringOrSequence(sink)({
|
|
14338
|
-
section: name,
|
|
14339
|
-
node,
|
|
14340
|
-
allowEmpty: false,
|
|
14341
|
-
allowElementEmpty: false
|
|
14342
|
-
});
|
|
14343
|
-
const labelsHandler = (sink) => (state, entry) => Option.match(mayParseExpression(entry.value), {
|
|
14344
|
-
onSome: (expression) => ({
|
|
14345
|
-
...state,
|
|
14346
|
-
labelsExpression: expression
|
|
14347
|
-
}),
|
|
14348
|
-
onNone: () => ({
|
|
14349
|
-
...state,
|
|
14350
|
-
labels: labels(sink)("labels", entry.value)
|
|
14351
|
-
})
|
|
14352
|
-
});
|
|
14353
|
-
const parseRunsOn = (sink) => (node) => {
|
|
14354
|
-
const expression = mayParseExpression(node);
|
|
14355
|
-
if (Option.isSome(expression)) return {
|
|
14356
|
-
labels: [],
|
|
14357
|
-
labelsExpression: expression.value
|
|
14358
|
-
};
|
|
14359
|
-
if (node.kind === "scalar" || node.kind === "sequence") return { labels: labels(sink)("runs-on", node) };
|
|
14360
|
-
return foldEntries({
|
|
14361
|
-
entries: section$1(sink)("runs-on", node),
|
|
14362
|
-
initial: { labels: [] },
|
|
14363
|
-
handlers: [["labels", labelsHandler(sink)], ["group", setters().set("group", entryText(sink)(false))]],
|
|
14364
|
-
unknown: rejecting({
|
|
14365
|
-
sink,
|
|
14366
|
-
section: "runs-on",
|
|
14367
|
-
expected: ["labels", "group"]
|
|
14368
|
-
})
|
|
14369
|
-
});
|
|
14370
|
-
};
|
|
14371
|
-
const snapshotMapping = (sink) => (at, node) => {
|
|
14372
|
-
const { set } = setters();
|
|
14373
|
-
const snapshot = foldEntries({
|
|
14374
|
-
entries: section$1(sink)("on", node),
|
|
14375
|
-
initial: {},
|
|
14376
|
-
handlers: [
|
|
14377
|
-
["image-name", set("imageName", entryText(sink)(false))],
|
|
14378
|
-
["version", set("version", entryText(sink)(false))],
|
|
14379
|
-
["if", set("condition", entryText(sink)(false))]
|
|
14380
|
-
],
|
|
14381
|
-
unknown: rejecting({
|
|
14382
|
-
sink,
|
|
14383
|
-
section: "snapshot",
|
|
14384
|
-
expected: [
|
|
14385
|
-
"image-name",
|
|
14386
|
-
"version",
|
|
14387
|
-
"if"
|
|
14388
|
-
]
|
|
14389
|
-
})
|
|
14390
|
-
});
|
|
14391
|
-
reportMissing(sink)(snapshot.imageName, at, "\"snapshot\" section must have \"image-name\" configuration");
|
|
14392
|
-
return snapshot;
|
|
14393
|
-
};
|
|
14394
|
-
const parseSnapshot = (sink) => (at, node) => {
|
|
14395
|
-
if (node.kind === "scalar") return Option.some({ imageName: parseString(sink)(node, false) });
|
|
14396
|
-
if (node.kind === "mapping") return Option.some(snapshotMapping(sink)(at, node));
|
|
14397
|
-
sink.error(node, `"snapshot" section value must be string or mapping but found ${node.kind} node`);
|
|
14398
|
-
return Option.none();
|
|
14399
|
-
};
|
|
14400
|
-
const parseCallValues = (sink) => (name, node) => entryRecord((entry) => ({
|
|
14401
|
-
name: entry.key,
|
|
14402
|
-
value: parseString(sink)(entry.value, true)
|
|
14403
|
-
}))(caselessSection(sink)(name, node));
|
|
14404
|
-
// src/app/presets/entities/workflow/lib/job-fields.ts
|
|
14405
|
-
const forJob = (handler) => (state, entry) => ({
|
|
14406
|
-
...state,
|
|
14407
|
-
job: handler(state.job, entry)
|
|
14408
|
-
});
|
|
14409
|
-
const stepsOnly = (handler) => (state, entry) => ({
|
|
14410
|
-
...forJob(handler)(state, entry),
|
|
14411
|
-
stepsOnly: entry.key
|
|
14412
|
-
});
|
|
14413
|
-
const callOnly = (handler) => (state, entry) => ({
|
|
14414
|
-
...state,
|
|
14415
|
-
call: handler(state.call, entry),
|
|
14416
|
-
callOnly: entry.key
|
|
14417
|
-
});
|
|
14418
|
-
const needs = (sink) => (entry) => {
|
|
14419
|
-
if (entry.value.kind === "scalar") return [parseString(sink)(entry.value, false)];
|
|
14420
|
-
return parseStringSequence(sink)({
|
|
14421
|
-
section: "needs",
|
|
14422
|
-
node: entry.value,
|
|
14423
|
-
allowEmpty: false,
|
|
14424
|
-
allowElementEmpty: false
|
|
14425
|
-
});
|
|
14426
|
-
};
|
|
14427
|
-
const callSecrets = (sink) => (call, entry) => {
|
|
14428
|
-
const node = entry.value;
|
|
14429
|
-
if (node.kind !== "scalar") return {
|
|
14430
|
-
...call,
|
|
14431
|
-
secrets: parseCallValues(sink)("secrets", node)
|
|
14432
|
-
};
|
|
14433
|
-
if (node.value === "inherit") return {
|
|
14434
|
-
...call,
|
|
14435
|
-
inheritSecrets: true
|
|
14436
|
-
};
|
|
14437
|
-
sink.error(node, `expected mapping node for secrets or "inherit" string node but found ${quote(node.value)} node`);
|
|
14438
|
-
return call;
|
|
14439
|
-
};
|
|
14440
|
-
const emptyJob = (id) => ({
|
|
14441
|
-
id,
|
|
14442
|
-
needs: [],
|
|
14443
|
-
outputs: {},
|
|
14444
|
-
line: id.line,
|
|
14445
|
-
column: id.column
|
|
14446
|
-
});
|
|
14447
|
-
// src/app/presets/entities/workflow/lib/sections.ts
|
|
14448
|
-
const parsePermissions = (sink) => (node) => {
|
|
14449
|
-
if (node.kind === "scalar") return {
|
|
14450
|
-
all: parseString(sink)(node, false),
|
|
14451
|
-
scopes: {}
|
|
14452
|
-
};
|
|
14453
|
-
const entries = emptyableCaselessSection(sink)("permissions", node);
|
|
14454
|
-
return { scopes: entryRecord((entry) => ({
|
|
14455
|
-
name: entry.key,
|
|
14456
|
-
value: entryText(sink)(false)(entry)
|
|
14457
|
-
}))(entries) };
|
|
14458
|
-
};
|
|
14459
|
-
const parseEnv = (sink) => (node) => {
|
|
14460
|
-
if (node.kind === "scalar") return {
|
|
14461
|
-
vars: {},
|
|
14462
|
-
...optional("expression")(parseExpression(sink)(node, "mapping value for \"env\" section"))
|
|
14463
|
-
};
|
|
14464
|
-
return { vars: entryRecord((entry) => ({
|
|
14465
|
-
name: entry.key,
|
|
14466
|
-
value: parseString(sink)(entry.value, true)
|
|
14467
|
-
}))(caselessSection(sink)("env", node)) };
|
|
14468
|
-
};
|
|
14469
|
-
const defaultsRun = (sink) => (node) => {
|
|
14470
|
-
const { set } = setters();
|
|
14471
|
-
return foldEntries({
|
|
14472
|
-
entries: section$1(sink)("run", node),
|
|
14473
|
-
initial: {},
|
|
14474
|
-
handlers: [["shell", set("shell", entryText(sink)(false))], ["working-directory", set("workingDirectory", entryText(sink)(false))]],
|
|
14475
|
-
unknown: rejecting({
|
|
14476
|
-
sink,
|
|
14477
|
-
section: "run",
|
|
14478
|
-
expected: ["shell", "working-directory"]
|
|
14479
|
-
})
|
|
14480
|
-
});
|
|
14481
|
-
};
|
|
14482
|
-
const parseDefaults = (sink) => (node) => {
|
|
14483
|
-
const defaults = foldEntries({
|
|
14484
|
-
entries: section$1(sink)("defaults", node),
|
|
14485
|
-
initial: {},
|
|
14486
|
-
handlers: [["run", setters().set("run", (entry) => defaultsRun(sink)(entry.value))]],
|
|
14487
|
-
unknown: rejecting({
|
|
14488
|
-
sink,
|
|
14489
|
-
section: "defaults",
|
|
14490
|
-
expected: ["run"]
|
|
14491
|
-
})
|
|
14492
|
-
});
|
|
14493
|
-
reportMissing(sink)(defaults.run, node, "\"defaults\" section should have \"run\" section");
|
|
14494
|
-
return defaults;
|
|
14495
|
-
};
|
|
14496
|
-
const parseConcurrency = (sink) => (at, node) => {
|
|
14497
|
-
if (node.kind === "scalar") return { group: parseString(sink)(node, false) };
|
|
14498
|
-
const { set, setSome } = setters();
|
|
14499
|
-
const concurrency = foldEntries({
|
|
14500
|
-
entries: section$1(sink)("concurrency", node),
|
|
14501
|
-
initial: {},
|
|
14502
|
-
handlers: [["group", set("group", entryText(sink)(false))], ["cancel-in-progress", setSome("cancelInProgress", (entry) => parseBool(sink)(entry.value))]],
|
|
14503
|
-
unknown: rejecting({
|
|
14504
|
-
sink,
|
|
14505
|
-
section: "concurrency",
|
|
14506
|
-
expected: ["group", "cancel-in-progress"]
|
|
14507
|
-
})
|
|
14508
|
-
});
|
|
14509
|
-
reportMissing(sink)(concurrency.group, at, "group name is missing in \"concurrency\" section");
|
|
14510
|
-
return concurrency;
|
|
14511
|
-
};
|
|
14512
|
-
const parseEnvironment = (sink) => (at, node) => {
|
|
14513
|
-
if (node.kind === "scalar") return { name: parseString(sink)(node, false) };
|
|
14514
|
-
const { set, setSome } = setters();
|
|
14515
|
-
const environment = foldEntries({
|
|
14516
|
-
entries: section$1(sink)("environment", node),
|
|
14517
|
-
initial: {},
|
|
14518
|
-
handlers: [
|
|
14519
|
-
["name", set("name", entryText(sink)(false))],
|
|
14520
|
-
["url", set("url", entryText(sink)(false))],
|
|
14521
|
-
["deployment", setSome("deployment", (entry) => parseBool(sink)(entry.value))]
|
|
14522
|
-
],
|
|
14523
|
-
unknown: rejecting({
|
|
14524
|
-
sink,
|
|
14525
|
-
section: "environment",
|
|
14526
|
-
expected: [
|
|
14527
|
-
"deployment",
|
|
14528
|
-
"name",
|
|
14529
|
-
"url"
|
|
14530
|
-
]
|
|
14531
|
-
})
|
|
14532
|
-
});
|
|
14533
|
-
reportMissing(sink)(environment.name, at, "name is missing in \"environment\" section");
|
|
14534
|
-
return environment;
|
|
14535
|
-
};
|
|
14536
|
-
const parseOutputs = (sink) => (node) => {
|
|
14537
|
-
const outputs = entryRecord((entry) => parseString(sink)(entry.value, true))(caselessSection(sink)("outputs", node));
|
|
14538
|
-
if (Record.isEmptyRecord(outputs)) reportEmpty(sink)("outputs", node);
|
|
14539
|
-
return outputs;
|
|
14540
|
-
};
|
|
14541
|
-
// src/app/presets/entities/workflow/lib/container.ts
|
|
14542
|
-
const parseCredentials = (sink) => (entry) => {
|
|
14543
|
-
const expression = mayParseExpression(entry.value);
|
|
14544
|
-
if (Option.isSome(expression)) return Option.some({ expression: expression.value });
|
|
14545
|
-
const { set } = setters();
|
|
14546
|
-
const credentials = foldEntries({
|
|
14547
|
-
entries: section$1(sink)("credentials", entry.value),
|
|
14548
|
-
initial: {},
|
|
14549
|
-
handlers: [["username", set("username", entryText(sink)(false))], ["password", set("password", entryText(sink)(false))]],
|
|
14550
|
-
unknown: rejecting({
|
|
14551
|
-
sink,
|
|
14552
|
-
section: "credentials",
|
|
14553
|
-
expected: ["username", "password"]
|
|
14554
|
-
})
|
|
14555
|
-
});
|
|
14556
|
-
if (Predicate.isUndefined(credentials.username) || Predicate.isUndefined(credentials.password)) {
|
|
14557
|
-
sink.error(entry.key, "both \"username\" and \"password\" must be specified in \"credentials\" section");
|
|
14558
|
-
return Option.none();
|
|
14559
|
-
}
|
|
14560
|
-
return Option.some(credentials);
|
|
14561
|
-
};
|
|
14562
|
-
const strings$2 = (sink, name) => (entry) => parseStringSequence(sink)({
|
|
14563
|
-
section: name,
|
|
14564
|
-
node: entry.value,
|
|
14565
|
-
allowEmpty: true,
|
|
14566
|
-
allowElementEmpty: false
|
|
14567
|
-
});
|
|
14568
|
-
const CONTAINER_KEYS = [
|
|
14569
|
-
"image",
|
|
14570
|
-
"credentials",
|
|
14571
|
-
"env",
|
|
14572
|
-
"ports",
|
|
14573
|
-
"volumes",
|
|
14574
|
-
"options"
|
|
14575
|
-
];
|
|
14576
|
-
const parseContainer = (sink) => (name, at, node) => {
|
|
14577
|
-
if (node.kind === "scalar") return {
|
|
14578
|
-
ports: [],
|
|
14579
|
-
volumes: [],
|
|
14580
|
-
image: parseString(sink)(node, false)
|
|
14581
|
-
};
|
|
14582
|
-
const { set, setSome } = setters();
|
|
14583
|
-
const container = foldEntries({
|
|
14584
|
-
entries: section$1(sink)(name, node),
|
|
14585
|
-
initial: {
|
|
14586
|
-
ports: [],
|
|
14587
|
-
volumes: []
|
|
14588
|
-
},
|
|
14589
|
-
handlers: [
|
|
14590
|
-
["image", set("image", entryText(sink)(false))],
|
|
14591
|
-
["credentials", setSome("credentials", parseCredentials(sink))],
|
|
14592
|
-
["env", set("env", (entry) => parseEnv(sink)(entry.value))],
|
|
14593
|
-
["ports", set("ports", strings$2(sink, "ports"))],
|
|
14594
|
-
["volumes", set("volumes", strings$2(sink, "volumes"))],
|
|
14595
|
-
["options", set("options", entryText(sink)(true))]
|
|
14596
|
-
],
|
|
14597
|
-
unknown: rejecting({
|
|
14598
|
-
sink,
|
|
14599
|
-
section: name,
|
|
14600
|
-
expected: CONTAINER_KEYS
|
|
14601
|
-
})
|
|
14602
|
-
});
|
|
14603
|
-
reportMissing(sink)(container.image, at, `"image" is missing in ${quote(name)} section`);
|
|
14604
|
-
return container;
|
|
14605
|
-
};
|
|
14606
|
-
const parseServices = (sink) => (node) => {
|
|
14607
|
-
const expression = mayParseExpression(node);
|
|
14608
|
-
if (Option.isSome(expression)) return {
|
|
14609
|
-
value: {},
|
|
14610
|
-
expression: expression.value
|
|
14611
|
-
};
|
|
14612
|
-
const entries = caselessSection(sink)("services", node);
|
|
14613
|
-
return { value: entryRecord((entry) => ({
|
|
14614
|
-
name: entry.key,
|
|
14615
|
-
container: parseContainer(sink)("services", entry.key, entry.value)
|
|
14616
|
-
}))(entries) };
|
|
14617
|
-
};
|
|
14618
|
-
// src/app/presets/entities/workflow/lib/raw-value.ts
|
|
14619
|
-
const rawEntries = (parse) => (entries) => sortedRecord(pipe(entries, Array$1.flatMap((entry) => pipe(parse(entry), Option.map((value) => [entry.id, value]), Option.toArray))));
|
|
14620
|
-
const rawArray = (node, parse) => ({
|
|
14621
|
-
line: node.line,
|
|
14622
|
-
column: node.column,
|
|
14623
|
-
type: "array",
|
|
14624
|
-
elems: pipe(node.children, Array$1.flatMap((child) => Option.toArray(parse(child))))
|
|
14625
|
-
});
|
|
14626
|
-
const rawObject = (sink, node, parse) => {
|
|
14627
|
-
const entries = parseMapping(sink)({
|
|
14628
|
-
place: "matrix row value",
|
|
14629
|
-
node,
|
|
14630
|
-
allowEmpty: true,
|
|
14631
|
-
caseSensitive: false
|
|
14632
|
-
});
|
|
14633
|
-
return {
|
|
14634
|
-
line: node.line,
|
|
14635
|
-
column: node.column,
|
|
14636
|
-
type: "object",
|
|
14637
|
-
props: rawEntries((entry) => parse(entry.value))(entries)
|
|
14638
|
-
};
|
|
14639
|
-
};
|
|
14640
|
-
const parseRawValue = (sink) => (node) => {
|
|
14641
|
-
if (node.kind === "scalar") return Option.some({
|
|
14642
|
-
line: node.line,
|
|
14643
|
-
column: node.column,
|
|
14644
|
-
type: "string",
|
|
14645
|
-
value: node.value
|
|
14646
|
-
});
|
|
14647
|
-
if (node.kind === "sequence") return Option.some(rawArray(node, parseRawValue(sink)));
|
|
14648
|
-
if (node.kind === "mapping") return Option.some(rawObject(sink, node, parseRawValue(sink)));
|
|
14649
|
-
sink.error(node, `unexpected ${node.kind} node on parsing value in matrix row`);
|
|
14650
|
-
return Option.none();
|
|
14651
|
-
};
|
|
14652
|
-
// src/app/presets/entities/workflow/lib/matrix-values.ts
|
|
14653
|
-
const combination = (sink, section) => (child) => {
|
|
14654
|
-
if (child.kind === "scalar") return Option.map(parseExpression(sink)(child, "mapping of matrix combination"), (expression) => ({
|
|
14655
|
-
assigns: {},
|
|
14656
|
-
expression
|
|
14657
|
-
}));
|
|
14658
|
-
const entries = parseMapping(sink)({
|
|
14659
|
-
place: `element in ${quote(section)} section`,
|
|
14660
|
-
node: child,
|
|
14661
|
-
allowEmpty: false,
|
|
14662
|
-
caseSensitive: false
|
|
14663
|
-
});
|
|
14664
|
-
const assigns = rawEntries((entry) => Option.map(parseRawValue(sink)(entry.value), (value) => ({
|
|
14665
|
-
key: entry.key,
|
|
14666
|
-
value
|
|
14667
|
-
})))(entries);
|
|
14668
|
-
return Option.some({ assigns });
|
|
14669
|
-
};
|
|
14670
|
-
const combinations = (sink) => (section, entry) => {
|
|
14671
|
-
const node = entry.value;
|
|
14672
|
-
if (node.kind === "scalar") return Option.some({
|
|
14673
|
-
combinations: [],
|
|
14674
|
-
...optional("expression")(parseExpression(sink)(node, "array of matrix combination"))
|
|
14675
|
-
});
|
|
14676
|
-
if (!checkSequence$1(sink)({
|
|
14677
|
-
section,
|
|
14678
|
-
node,
|
|
14679
|
-
allowEmpty: false
|
|
14680
|
-
})) return Option.none();
|
|
14681
|
-
return Option.some({ combinations: pipe(node.children, Array$1.flatMap((child) => Option.toArray(combination(sink, section)(child)))) });
|
|
14682
|
-
};
|
|
14683
|
-
const row = (sink) => (entry) => {
|
|
14684
|
-
if (entry.value.kind === "scalar") {
|
|
14685
|
-
const expression = parseExpression(sink)(entry.value, "array value for matrix variations");
|
|
14686
|
-
return Option.some({
|
|
14687
|
-
values: [],
|
|
14688
|
-
...optional("expression")(expression)
|
|
14689
|
-
});
|
|
14690
|
-
}
|
|
14691
|
-
if (!checkSequence$1(sink)({
|
|
14692
|
-
section: "matrix values",
|
|
14693
|
-
node: entry.value,
|
|
14694
|
-
allowEmpty: false
|
|
14695
|
-
})) return Option.none();
|
|
14696
|
-
return Option.some({
|
|
14697
|
-
name: entry.key,
|
|
14698
|
-
values: pipe(entry.value.children, Array$1.flatMap((child) => Option.toArray(parseRawValue(sink)(child))))
|
|
14699
|
-
});
|
|
14700
|
-
};
|
|
14701
|
-
// src/app/presets/entities/workflow/lib/matrix.ts
|
|
14702
|
-
const addRow = (sink) => (state, entry) => Option.match(row(sink)(entry), {
|
|
14703
|
-
onNone: () => state,
|
|
14704
|
-
onSome: (value) => ({
|
|
14705
|
-
...state,
|
|
14706
|
-
rows: {
|
|
14707
|
-
...state.rows,
|
|
14708
|
-
[entry.id]: value
|
|
14709
|
-
}
|
|
14710
|
-
})
|
|
14711
|
-
});
|
|
14712
|
-
const emptyMatrix = (at) => ({
|
|
14713
|
-
rows: {},
|
|
14714
|
-
line: at.line,
|
|
14715
|
-
column: at.column
|
|
14716
|
-
});
|
|
14717
|
-
const parseMatrix = (sink) => (at, node) => {
|
|
14718
|
-
if (node.kind === "scalar") return {
|
|
14719
|
-
...emptyMatrix(node),
|
|
14720
|
-
...optional("expression")(parseExpression(sink)(node, "matrix"))
|
|
14721
|
-
};
|
|
14722
|
-
const { setSome } = setters();
|
|
14723
|
-
const matrix = foldEntries({
|
|
14724
|
-
entries: caselessSection(sink)("matrix", node),
|
|
14725
|
-
initial: emptyMatrix(at),
|
|
14726
|
-
handlers: [["include", setSome("include", (entry) => combinations(sink)("include", entry))], ["exclude", setSome("exclude", (entry) => combinations(sink)("exclude", entry))]],
|
|
14727
|
-
unknown: addRow(sink)
|
|
14728
|
-
});
|
|
14729
|
-
return {
|
|
14730
|
-
...matrix,
|
|
14731
|
-
rows: sortedRecord(Record.toEntries(matrix.rows))
|
|
14732
|
-
};
|
|
14733
|
-
};
|
|
14734
|
-
// src/app/presets/entities/workflow/lib/strategy.ts
|
|
14735
|
-
const ZERO = 0;
|
|
14736
|
-
const maxParallel = (sink) => (entry) => {
|
|
14737
|
-
const parsed = parseInteger(sink)(entry.value);
|
|
14738
|
-
if (Option.isSome(parsed) && Predicate.isUndefined(parsed.value.expression) && parsed.value.value <= ZERO) sink.error(entry.value, `value at "max-parallel" must be greater than zero: ${String(parsed.value.value)}`);
|
|
14739
|
-
return parsed;
|
|
14740
|
-
};
|
|
14741
|
-
const parseStrategy = (sink) => (node) => {
|
|
14742
|
-
const { setSome } = setters();
|
|
14743
|
-
return foldEntries({
|
|
14744
|
-
entries: section$1(sink)("strategy", node),
|
|
14745
|
-
initial: {},
|
|
14746
|
-
handlers: [
|
|
14747
|
-
["matrix", setSome("matrix", (entry) => Option.some(parseMatrix(sink)(entry.key, entry.value)))],
|
|
14748
|
-
["fail-fast", setSome("failFast", (entry) => parseBool(sink)(entry.value))],
|
|
14749
|
-
["max-parallel", setSome("maxParallel", maxParallel(sink))]
|
|
14750
|
-
],
|
|
14751
|
-
unknown: rejecting({
|
|
14752
|
-
sink,
|
|
14753
|
-
section: "strategy",
|
|
14754
|
-
expected: [
|
|
14755
|
-
"matrix",
|
|
14756
|
-
"fail-fast",
|
|
14757
|
-
"max-parallel"
|
|
14758
|
-
]
|
|
14759
|
-
})
|
|
14760
|
-
});
|
|
14761
|
-
};
|
|
14762
|
-
// src/app/presets/entities/workflow/lib/job-general.ts
|
|
14763
|
-
const generalHandlers = (sink) => {
|
|
14764
|
-
const { set, setSome } = setters();
|
|
14765
|
-
const call = setters();
|
|
14766
|
-
return [
|
|
14767
|
-
["name", forJob(set("name", (entry) => parseString(sink)(entry.value, true)))],
|
|
14768
|
-
["needs", forJob(set("needs", needs(sink)))],
|
|
14769
|
-
["permissions", forJob(set("permissions", (entry) => parsePermissions(sink)(entry.value)))],
|
|
14770
|
-
["concurrency", forJob(set("concurrency", (entry) => parseConcurrency(sink)(entry.key, entry.value)))],
|
|
14771
|
-
["if", forJob(set("condition", (entry) => parseString(sink)(entry.value, false)))],
|
|
14772
|
-
["strategy", forJob(set("strategy", (entry) => parseStrategy(sink)(entry.value)))],
|
|
14773
|
-
["services", forJob(set("services", (entry) => parseServices(sink)(entry.value)))],
|
|
14774
|
-
["snapshot", forJob(setSome("snapshot", (entry) => parseSnapshot(sink)(entry.key, entry.value)))],
|
|
14775
|
-
["uses", callOnly(call.set("uses", (entry) => parseString(sink)(entry.value, false)))],
|
|
14776
|
-
["with", callOnly(call.set("inputs", (entry) => parseCallValues(sink)("with", entry.value)))],
|
|
14777
|
-
["secrets", callOnly(callSecrets(sink))]
|
|
14778
|
-
];
|
|
14779
|
-
};
|
|
14780
|
-
// src/app/presets/entities/workflow/lib/exec.ts
|
|
14781
|
-
const COMMON = [
|
|
14782
|
-
"id",
|
|
14783
|
-
"if",
|
|
14784
|
-
"name",
|
|
14785
|
-
"env",
|
|
14786
|
-
"continue-on-error",
|
|
14787
|
-
"timeout-minutes"
|
|
14788
|
-
];
|
|
14789
|
-
const common = () => pipe(COMMON, Array$1.map((key) => [key, keep]));
|
|
14790
|
-
const withInput = (sink, docker) => (state, item) => {
|
|
14791
|
-
if (docker && item.id === "entrypoint") return {
|
|
14792
|
-
...state,
|
|
14793
|
-
action: {
|
|
14794
|
-
...state.action,
|
|
14795
|
-
entrypoint: entryText(sink)(false)(item)
|
|
14796
|
-
}
|
|
14797
|
-
};
|
|
14798
|
-
if (docker && item.id === "args") return {
|
|
14799
|
-
...state,
|
|
14800
|
-
action: {
|
|
14801
|
-
...state.action,
|
|
14802
|
-
args: entryText(sink)(true)(item)
|
|
14803
|
-
}
|
|
14804
|
-
};
|
|
14805
|
-
const input = {
|
|
14806
|
-
name: item.key,
|
|
14807
|
-
value: entryText(sink)(true)(item)
|
|
14808
|
-
};
|
|
14809
|
-
return {
|
|
14810
|
-
...state,
|
|
14811
|
-
inputs: [...state.inputs, [item.id, input]]
|
|
14812
|
-
};
|
|
14813
|
-
};
|
|
14814
|
-
const parseWith = (sink, docker) => (action, entry) => {
|
|
14815
|
-
const state = foldEntries({
|
|
14816
|
-
entries: caselessSection(sink)("with", entry.value),
|
|
14817
|
-
initial: {
|
|
14818
|
-
action,
|
|
14819
|
-
inputs: []
|
|
14820
|
-
},
|
|
14821
|
-
handlers: [],
|
|
14822
|
-
unknown: withInput(sink, docker)
|
|
14823
|
-
});
|
|
14824
|
-
return {
|
|
14825
|
-
...state.action,
|
|
14826
|
-
inputs: sortedRecord(state.inputs)
|
|
14827
|
-
};
|
|
14828
|
-
};
|
|
14829
|
-
const execAction = (sink) => (entries, docker) => foldEntries({
|
|
14830
|
-
entries,
|
|
14831
|
-
initial: { type: "action" },
|
|
14832
|
-
handlers: [
|
|
14833
|
-
...common(),
|
|
14834
|
-
["uses", setters().set("uses", entryText(sink)(false))],
|
|
14835
|
-
["with", parseWith(sink, docker)]
|
|
14836
|
-
],
|
|
14837
|
-
unknown: rejecting({
|
|
14838
|
-
sink,
|
|
14839
|
-
section: "step to execute action",
|
|
14840
|
-
expected: [
|
|
14841
|
-
...COMMON,
|
|
14842
|
-
"uses",
|
|
14843
|
-
"with"
|
|
14844
|
-
]
|
|
14845
|
-
})
|
|
14846
|
-
});
|
|
14847
|
-
const runHandler = (sink) => (state, entry) => ({
|
|
14848
|
-
...state,
|
|
14849
|
-
run: entryText(sink)(false)(entry),
|
|
14850
|
-
runPosition: entry.key
|
|
14851
|
-
});
|
|
14852
|
-
const execRun = (sink) => (entries) => {
|
|
14853
|
-
const { set } = setters();
|
|
14854
|
-
return foldEntries({
|
|
14855
|
-
entries,
|
|
14856
|
-
initial: { type: "run" },
|
|
14857
|
-
handlers: [
|
|
14858
|
-
...common(),
|
|
14859
|
-
["run", runHandler(sink)],
|
|
14860
|
-
["shell", set("shell", entryText(sink)(false))],
|
|
14861
|
-
["working-directory", set("workingDirectory", entryText(sink)(false))]
|
|
14862
|
-
],
|
|
14863
|
-
unknown: rejecting({
|
|
14864
|
-
sink,
|
|
14865
|
-
section: "step to run shell command",
|
|
14866
|
-
expected: [
|
|
14867
|
-
...COMMON,
|
|
14868
|
-
"run",
|
|
14869
|
-
"shell",
|
|
14870
|
-
"working-directory"
|
|
14871
|
-
]
|
|
14872
|
-
})
|
|
14873
|
-
});
|
|
14874
|
-
};
|
|
14875
|
-
// src/app/presets/entities/workflow/lib/steps.ts
|
|
14876
|
-
const lift$1 = (handler) => (state, entry) => ({
|
|
14877
|
-
...state,
|
|
14878
|
-
step: handler(state.step, entry)
|
|
14879
|
-
});
|
|
14880
|
-
const usesShape = (state, entry) => {
|
|
14881
|
-
if (String$1.startsWith("docker://")(entry.value.value)) return {
|
|
14882
|
-
...state,
|
|
14883
|
-
shape: "docker"
|
|
14884
|
-
};
|
|
14885
|
-
return {
|
|
14886
|
-
...state,
|
|
14887
|
-
shape: "action"
|
|
14888
|
-
};
|
|
14889
|
-
};
|
|
14890
|
-
const runShape = (state) => ({
|
|
14891
|
-
...state,
|
|
14892
|
-
shape: "run"
|
|
14893
|
-
});
|
|
14894
|
-
const stepHandlers$1 = (sink) => {
|
|
14895
|
-
const { set, setSome } = setters();
|
|
14896
|
-
const text = (allowEmpty) => (entry) => parseString(sink)(entry.value, allowEmpty);
|
|
14897
|
-
return [
|
|
14898
|
-
["id", lift$1(set("id", text(false)))],
|
|
14899
|
-
["if", lift$1(set("condition", text(false)))],
|
|
14900
|
-
["name", lift$1(set("name", text(true)))],
|
|
14901
|
-
["env", lift$1(set("env", (entry) => parseEnv(sink)(entry.value)))],
|
|
14902
|
-
["continue-on-error", lift$1(setSome("continueOnError", (entry) => parseBool(sink)(entry.value)))],
|
|
14903
|
-
["timeout-minutes", lift$1(setSome("timeoutMinutes", (entry) => parseTimeoutMinutes(sink)(entry.value)))],
|
|
14904
|
-
["uses", usesShape],
|
|
14905
|
-
["run", runShape]
|
|
14906
|
-
];
|
|
14907
|
-
};
|
|
14908
|
-
const execOf = (sink) => (shape, entries) => {
|
|
14909
|
-
if (shape === "run") return Option.some(execRun(sink)(entries));
|
|
14910
|
-
if (shape === "unknown") return Option.none();
|
|
14911
|
-
return Option.some(execAction(sink)(entries, shape === "docker"));
|
|
14912
|
-
};
|
|
14913
|
-
const parseStep = (sink) => (node) => {
|
|
14914
|
-
const entries = parseMapping(sink)({
|
|
14915
|
-
place: "element of \"steps\" section",
|
|
14916
|
-
node,
|
|
14917
|
-
allowEmpty: false,
|
|
14918
|
-
caseSensitive: true
|
|
14919
|
-
});
|
|
14920
|
-
const state = foldEntries({
|
|
14921
|
-
entries,
|
|
14922
|
-
initial: {
|
|
14923
|
-
step: {},
|
|
14924
|
-
shape: "unknown"
|
|
14925
|
-
},
|
|
14926
|
-
handlers: stepHandlers$1(sink),
|
|
14927
|
-
unknown: keep
|
|
14928
|
-
});
|
|
14929
|
-
if (state.shape === "unknown") sink.error(node, "step must run script with \"run\" section or run action with \"uses\" section");
|
|
14930
|
-
return Option.match(execOf(sink)(state.shape, entries), {
|
|
14931
|
-
onNone: () => state.step,
|
|
14932
|
-
onSome: (exec) => ({
|
|
14933
|
-
...state.step,
|
|
14934
|
-
exec
|
|
14935
|
-
})
|
|
14936
|
-
});
|
|
14937
|
-
};
|
|
14938
|
-
const parseSteps = (sink) => (node) => {
|
|
14939
|
-
if (!checkSequence$1(sink)({
|
|
14940
|
-
section: "steps",
|
|
14941
|
-
node,
|
|
14942
|
-
allowEmpty: false
|
|
14943
|
-
})) return Option.none();
|
|
14944
|
-
return Option.some(pipe(node.children, Array$1.map((child) => parseStep(sink)(child))));
|
|
14945
|
-
};
|
|
14946
|
-
// src/app/presets/entities/workflow/lib/job-steps.ts
|
|
14947
|
-
const stepHandlers = (sink) => {
|
|
14948
|
-
const { set, setSome } = setters();
|
|
14949
|
-
return [
|
|
14950
|
-
["runs-on", stepsOnly(set("runsOn", (entry) => parseRunsOn(sink)(entry.value)))],
|
|
14951
|
-
["environment", stepsOnly(set("environment", (entry) => parseEnvironment(sink)(entry.key, entry.value)))],
|
|
14952
|
-
["outputs", stepsOnly(set("outputs", (entry) => parseOutputs(sink)(entry.value)))],
|
|
14953
|
-
["env", stepsOnly(set("env", (entry) => parseEnv(sink)(entry.value)))],
|
|
14954
|
-
["defaults", stepsOnly(set("defaults", (entry) => parseDefaults(sink)(entry.value)))],
|
|
14955
|
-
["steps", stepsOnly(setSome("steps", (entry) => parseSteps(sink)(entry.value)))],
|
|
14956
|
-
["timeout-minutes", stepsOnly(setSome("timeoutMinutes", (entry) => parseTimeoutMinutes(sink)(entry.value)))],
|
|
14957
|
-
["continue-on-error", stepsOnly(setSome("continueOnError", (entry) => parseBool(sink)(entry.value)))],
|
|
14958
|
-
["container", stepsOnly(set("container", (entry) => parseContainer(sink)("container", entry.key, entry.value)))]
|
|
14959
|
-
];
|
|
14960
|
-
};
|
|
14961
|
-
// src/app/presets/entities/workflow/lib/job.ts
|
|
14962
|
-
const JOB_KEYS = [
|
|
14963
|
-
"name",
|
|
14964
|
-
"needs",
|
|
14965
|
-
"runs-on",
|
|
14966
|
-
"permissions",
|
|
14967
|
-
"environment",
|
|
14968
|
-
"concurrency",
|
|
14969
|
-
"outputs",
|
|
14970
|
-
"env",
|
|
14971
|
-
"defaults",
|
|
14972
|
-
"if",
|
|
14973
|
-
"steps",
|
|
14974
|
-
"timeout-minutes",
|
|
14975
|
-
"strategy",
|
|
14976
|
-
"continue-on-error",
|
|
14977
|
-
"container",
|
|
14978
|
-
"services",
|
|
14979
|
-
"uses",
|
|
14980
|
-
"with",
|
|
14981
|
-
"secrets",
|
|
14982
|
-
"snapshot"
|
|
14983
|
-
];
|
|
14984
|
-
const finishCall = (sink) => (state) => {
|
|
14985
|
-
const key = state.stepsOnly;
|
|
14986
|
-
if (Predicate.isUndefined(key)) return {
|
|
14987
|
-
...state.job,
|
|
14988
|
-
workflowCall: state.call
|
|
14989
|
-
};
|
|
14990
|
-
sink.error(key, `when a reusable workflow is called with "uses", ${quote(key.value)} is not available. only following keys are allowed: "name", "uses", "with", "secrets", "needs", "if", and "permissions" in job ${quote(state.job.id.value)}`);
|
|
14991
|
-
return state.job;
|
|
14992
|
-
};
|
|
14993
|
-
const finishSteps = (sink) => (state) => {
|
|
14994
|
-
const { job, callOnly: key } = state;
|
|
14995
|
-
const id = quote(job.id.value);
|
|
14996
|
-
reportMissing(sink)(job.steps, job.id, `"steps" section is missing in job ${id}`);
|
|
14997
|
-
reportMissing(sink)(job.runsOn, job.id, `"runs-on" section is missing in job ${id}`);
|
|
14998
|
-
if (Predicate.isNotUndefined(key)) sink.error(key, `${quote(key.value)} is only available for a reusable workflow call with "uses" but "uses" is not found in job ${id}`);
|
|
14999
|
-
return job;
|
|
15000
|
-
};
|
|
15001
|
-
const parseJob = (sink) => (id, node) => {
|
|
15002
|
-
const state = foldEntries({
|
|
15003
|
-
entries: parseMapping(sink)({
|
|
15004
|
-
place: `${quote(id.value)} job`,
|
|
15005
|
-
node,
|
|
15006
|
-
allowEmpty: false,
|
|
15007
|
-
caseSensitive: true
|
|
15008
|
-
}),
|
|
15009
|
-
initial: {
|
|
15010
|
-
job: emptyJob(id),
|
|
15011
|
-
call: {
|
|
15012
|
-
inputs: {},
|
|
15013
|
-
secrets: {},
|
|
15014
|
-
inheritSecrets: false
|
|
15015
|
-
}
|
|
15016
|
-
},
|
|
15017
|
-
handlers: [...generalHandlers(sink), ...stepHandlers(sink)],
|
|
15018
|
-
unknown: rejecting({
|
|
15019
|
-
sink,
|
|
15020
|
-
section: "job",
|
|
15021
|
-
expected: JOB_KEYS
|
|
15022
|
-
})
|
|
15023
|
-
});
|
|
15024
|
-
if (Predicate.isUndefined(state.call.uses)) return finishSteps(sink)(state);
|
|
15025
|
-
return finishCall(sink)(state);
|
|
15026
|
-
};
|
|
15027
|
-
// src/app/presets/entities/workflow/lib/dispatch.ts
|
|
15028
|
-
const DISPATCH_TYPES$1 = {
|
|
15029
|
-
string: "string",
|
|
15030
|
-
number: "number",
|
|
15031
|
-
boolean: "boolean",
|
|
15032
|
-
choice: "choice",
|
|
15033
|
-
environment: "environment"
|
|
15034
|
-
};
|
|
15035
|
-
const dispatchType = (sink) => (state, entry) => {
|
|
15036
|
-
const node = entry.value;
|
|
15037
|
-
if (!checkString$1(sink)(node, false)) return state;
|
|
15038
|
-
return Option.match(Record.get(DISPATCH_TYPES$1, node.value), {
|
|
15039
|
-
onSome: (kind) => ({
|
|
15040
|
-
...state,
|
|
15041
|
-
kind
|
|
15042
|
-
}),
|
|
15043
|
-
onNone: () => {
|
|
15044
|
-
sink.error(node, `input type of workflow_dispatch event must be one of "string", "number", "boolean", "choice", "environment" but got ${quote(node.value)}`);
|
|
15045
|
-
return state;
|
|
15046
|
-
}
|
|
15047
|
-
});
|
|
15048
|
-
};
|
|
15049
|
-
const strings$1 = (sink, section) => (entry) => parseStringSequence(sink)({
|
|
15050
|
-
section,
|
|
15051
|
-
node: entry.value,
|
|
15052
|
-
allowEmpty: false,
|
|
15053
|
-
allowElementEmpty: false
|
|
15054
|
-
});
|
|
15055
|
-
const dispatchInput = (sink) => (input) => {
|
|
15056
|
-
const { set, setSome } = setters();
|
|
15057
|
-
return foldEntries({
|
|
15058
|
-
entries: parseMapping(sink)({
|
|
15059
|
-
place: "input settings of workflow_dispatch event",
|
|
15060
|
-
node: input.value,
|
|
15061
|
-
allowEmpty: true,
|
|
15062
|
-
caseSensitive: true
|
|
15063
|
-
}),
|
|
15064
|
-
initial: {
|
|
15065
|
-
name: input.key,
|
|
15066
|
-
kind: "none",
|
|
15067
|
-
options: []
|
|
15068
|
-
},
|
|
15069
|
-
handlers: [
|
|
15070
|
-
["description", set("description", entryText(sink)(true))],
|
|
15071
|
-
["required", setSome("required", (entry) => parseBool(sink)(entry.value))],
|
|
15072
|
-
["default", set("default", entryText(sink)(true))],
|
|
15073
|
-
["type", dispatchType(sink)],
|
|
15074
|
-
["options", set("options", strings$1(sink, "options"))]
|
|
15075
|
-
],
|
|
15076
|
-
unknown: rejecting({
|
|
15077
|
-
sink,
|
|
15078
|
-
section: "inputs",
|
|
15079
|
-
expected: [
|
|
15080
|
-
"description",
|
|
15081
|
-
"required",
|
|
15082
|
-
"default"
|
|
15083
|
-
]
|
|
15084
|
-
})
|
|
15085
|
-
});
|
|
15086
|
-
};
|
|
15087
|
-
const emptyDispatch = (at) => ({
|
|
15088
|
-
type: "workflow_dispatch",
|
|
15089
|
-
inputs: {},
|
|
15090
|
-
line: at.line,
|
|
15091
|
-
column: at.column
|
|
15092
|
-
});
|
|
15093
|
-
const parseWorkflowDispatch = (sink) => (at, node) => foldEntries({
|
|
15094
|
-
entries: emptyableSection(sink)("workflow_dispatch", node),
|
|
15095
|
-
initial: emptyDispatch(at),
|
|
15096
|
-
handlers: [["inputs", setters().set("inputs", (entry) => entryRecord(dispatchInput(sink))(emptyableCaselessSection(sink)("inputs", entry.value)))]],
|
|
15097
|
-
unknown: rejecting({
|
|
15098
|
-
sink,
|
|
15099
|
-
section: "workflow_dispatch",
|
|
15100
|
-
expected: ["inputs"]
|
|
15101
|
-
})
|
|
15102
|
-
});
|
|
15103
|
-
const EMPTY_IMAGE_VERSION = {
|
|
15104
|
-
type: "image_version",
|
|
15105
|
-
names: [],
|
|
15106
|
-
versions: []
|
|
15107
|
-
};
|
|
15108
|
-
const parseImageVersion = (sink) => (node) => {
|
|
15109
|
-
const { set } = setters();
|
|
15110
|
-
return foldEntries({
|
|
15111
|
-
entries: emptyableSection(sink)("image_version", node),
|
|
15112
|
-
initial: EMPTY_IMAGE_VERSION,
|
|
15113
|
-
handlers: [["names", set("names", strings$1(sink, "names"))], ["versions", set("versions", strings$1(sink, "versions"))]],
|
|
15114
|
-
unknown: rejecting({
|
|
15115
|
-
sink,
|
|
15116
|
-
section: "image_version",
|
|
15117
|
-
expected: ["names", "versions"]
|
|
15118
|
-
})
|
|
15119
|
-
});
|
|
15120
|
-
};
|
|
15121
|
-
// src/app/presets/entities/workflow/lib/events.ts
|
|
15122
|
-
const SCHEDULE_ELEMENT = "element of \"schedule\" section";
|
|
15123
|
-
const nonEmpty$1 = (sink) => (entry) => Option.liftPredicate(parseString(sink)(entry.value, false), (text) => text.value !== "");
|
|
15124
|
-
const scheduleEntry = (sink) => (node) => {
|
|
15125
|
-
const { setSome } = setters();
|
|
15126
|
-
const state = foldEntries({
|
|
15127
|
-
entries: parseMapping(sink)({
|
|
15128
|
-
place: SCHEDULE_ELEMENT,
|
|
15129
|
-
node,
|
|
15130
|
-
allowEmpty: false,
|
|
15131
|
-
caseSensitive: true
|
|
15132
|
-
}),
|
|
15133
|
-
initial: {},
|
|
15134
|
-
handlers: [["cron", setSome("cron", nonEmpty$1(sink))], ["timezone", setSome("timezone", nonEmpty$1(sink))]],
|
|
15135
|
-
unknown: rejecting({
|
|
15136
|
-
sink,
|
|
15137
|
-
section: SCHEDULE_ELEMENT,
|
|
15138
|
-
expected: ["cron", "timezone"]
|
|
15139
|
-
})
|
|
15140
|
-
});
|
|
15141
|
-
return pipe(Option.fromNullishOr(state.cron), Option.map((cron) => ({
|
|
15142
|
-
cron,
|
|
15143
|
-
...optional("timezone")(Option.fromNullishOr(state.timezone))
|
|
15144
|
-
})));
|
|
15145
|
-
};
|
|
15146
|
-
const parseSchedule = (sink) => (node) => {
|
|
15147
|
-
if (!checkSequence$1(sink)({
|
|
15148
|
-
section: "schedule",
|
|
15149
|
-
node,
|
|
15150
|
-
allowEmpty: false
|
|
15151
|
-
})) return Option.none();
|
|
15152
|
-
return Option.some({
|
|
15153
|
-
type: "schedule",
|
|
15154
|
-
schedules: pipe(node.children, Array$1.flatMap((child) => Option.toArray(scheduleEntry(sink)(child))))
|
|
15155
|
-
});
|
|
15156
|
-
};
|
|
15157
|
-
const strings = (sink) => (entry) => parseStringOrSequence(sink)({
|
|
15158
|
-
section: entry.key.value,
|
|
15159
|
-
node: entry.value,
|
|
15160
|
-
allowEmpty: false,
|
|
15161
|
-
allowElementEmpty: false
|
|
15162
|
-
});
|
|
15163
|
-
const parseRepositoryDispatch = (sink) => (node) => foldEntries({
|
|
15164
|
-
entries: emptyableSection(sink)("repository_dispatch", node),
|
|
15165
|
-
initial: {
|
|
15166
|
-
type: "repository_dispatch",
|
|
15167
|
-
types: []
|
|
15168
|
-
},
|
|
15169
|
-
handlers: [["types", setters().set("types", strings(sink))]],
|
|
15170
|
-
unknown: rejecting({
|
|
15171
|
-
sink,
|
|
15172
|
-
section: "repository_dispatch",
|
|
15173
|
-
expected: ["types"]
|
|
15174
|
-
})
|
|
15175
|
-
});
|
|
15176
|
-
const WEBHOOK_FILTERS = [
|
|
15177
|
-
["branches", "branches"],
|
|
15178
|
-
["branches-ignore", "branchesIgnore"],
|
|
15179
|
-
["tags", "tags"],
|
|
15180
|
-
["tags-ignore", "tagsIgnore"],
|
|
15181
|
-
["paths", "paths"],
|
|
15182
|
-
["paths-ignore", "pathsIgnore"]
|
|
15183
|
-
];
|
|
15184
|
-
const WEBHOOK_KEYS = [
|
|
15185
|
-
"types",
|
|
15186
|
-
"branches",
|
|
15187
|
-
"branches-ignore",
|
|
15188
|
-
"tags",
|
|
15189
|
-
"tags-ignore",
|
|
15190
|
-
"paths",
|
|
15191
|
-
"paths-ignore",
|
|
15192
|
-
"workflows"
|
|
15193
|
-
];
|
|
15194
|
-
const emptyWebhook = (name) => ({
|
|
15195
|
-
type: "webhook",
|
|
15196
|
-
hook: name,
|
|
15197
|
-
types: [],
|
|
15198
|
-
workflows: [],
|
|
15199
|
-
line: name.line,
|
|
15200
|
-
column: name.column
|
|
15201
|
-
});
|
|
15202
|
-
const webhookHandlers = (sink) => {
|
|
15203
|
-
const { set } = setters();
|
|
15204
|
-
const filter = (entry) => ({
|
|
15205
|
-
name: entry.key,
|
|
15206
|
-
values: strings(sink)(entry)
|
|
15207
|
-
});
|
|
15208
|
-
return [
|
|
15209
|
-
["types", set("types", strings(sink))],
|
|
15210
|
-
["workflows", set("workflows", strings(sink))],
|
|
15211
|
-
...pipe(WEBHOOK_FILTERS, Array$1.map(([key, field]) => [key, set(field, filter)]))
|
|
15212
|
-
];
|
|
15213
|
-
};
|
|
15214
|
-
const parseWebhook = (sink) => (name, node) => foldEntries({
|
|
15215
|
-
entries: emptyableSection(sink)(name.value, node),
|
|
15216
|
-
initial: emptyWebhook(name),
|
|
15217
|
-
handlers: webhookHandlers(sink),
|
|
15218
|
-
unknown: rejecting({
|
|
15219
|
-
sink,
|
|
15220
|
-
section: name.value,
|
|
15221
|
-
expected: WEBHOOK_KEYS
|
|
15222
|
-
})
|
|
15223
|
-
});
|
|
15224
|
-
// src/app/presets/entities/workflow/lib/workflow-call.ts
|
|
15225
|
-
const CALL_TYPES$1 = {
|
|
15226
|
-
boolean: "boolean",
|
|
15227
|
-
number: "number",
|
|
15228
|
-
string: "string"
|
|
15229
|
-
};
|
|
15230
|
-
const inputType = (sink) => (state, entry) => {
|
|
15231
|
-
const node = entry.value;
|
|
15232
|
-
if (!checkString$1(sink)(node, false)) return {
|
|
15233
|
-
...state,
|
|
15234
|
-
typed: true
|
|
15235
|
-
};
|
|
15236
|
-
return Option.match(Record.get(CALL_TYPES$1, node.value), {
|
|
15237
|
-
onSome: (kind) => ({
|
|
15238
|
-
input: {
|
|
15239
|
-
...state.input,
|
|
15240
|
-
kind
|
|
15241
|
-
},
|
|
15242
|
-
typed: true
|
|
15243
|
-
}),
|
|
15244
|
-
onNone: () => {
|
|
15245
|
-
sink.error(node, `invalid value ${quote(node.value)} for input type of workflow_call event. it must be one of "boolean", "number", or "string"`);
|
|
15246
|
-
return {
|
|
15247
|
-
...state,
|
|
15248
|
-
typed: true
|
|
15249
|
-
};
|
|
15250
|
-
}
|
|
15251
|
-
});
|
|
15252
|
-
};
|
|
15253
|
-
const lift = (handler) => (state, entry) => ({
|
|
15254
|
-
...state,
|
|
15255
|
-
input: handler(state.input, entry)
|
|
15256
|
-
});
|
|
15257
|
-
const required = (sink) => (entry) => parseBool(sink)(entry.value);
|
|
15258
|
-
const mappingOf = (sink, place) => (entry) => parseMapping(sink)({
|
|
15259
|
-
place,
|
|
15260
|
-
node: entry.value,
|
|
15261
|
-
allowEmpty: true,
|
|
15262
|
-
caseSensitive: true
|
|
15263
|
-
});
|
|
15264
|
-
const callInput = (sink) => (entry) => {
|
|
15265
|
-
const { set, setSome } = setters();
|
|
15266
|
-
const description = lift(set("description", entryText(sink)(true)));
|
|
15267
|
-
const isRequired = lift(setSome("required", required(sink)));
|
|
15268
|
-
const fallback = lift(set("default", entryText(sink)(true)));
|
|
15269
|
-
const state = foldEntries({
|
|
15270
|
-
entries: mappingOf(sink, "input of workflow_call event")(entry),
|
|
15271
|
-
initial: {
|
|
15272
|
-
input: {
|
|
15273
|
-
id: entry.id,
|
|
15274
|
-
name: entry.key,
|
|
15275
|
-
kind: "invalid"
|
|
15276
|
-
},
|
|
15277
|
-
typed: false
|
|
15278
|
-
},
|
|
15279
|
-
handlers: [
|
|
15280
|
-
["description", description],
|
|
15281
|
-
["required", isRequired],
|
|
15282
|
-
["default", fallback],
|
|
15283
|
-
["type", inputType(sink)]
|
|
15284
|
-
],
|
|
15285
|
-
unknown: rejecting({
|
|
15286
|
-
sink,
|
|
15287
|
-
section: "inputs at workflow_call event",
|
|
15288
|
-
expected: [
|
|
15289
|
-
"description",
|
|
15290
|
-
"required",
|
|
15291
|
-
"default",
|
|
15292
|
-
"type"
|
|
15293
|
-
]
|
|
15294
|
-
})
|
|
15295
|
-
});
|
|
15296
|
-
if (!state.typed) sink.error(entry.key, `"type" is missing at ${quote(entry.key.value)} input of workflow_call event`);
|
|
15297
|
-
return state.input;
|
|
15298
|
-
};
|
|
15299
|
-
const callSecret = (sink) => (entry) => {
|
|
15300
|
-
const { set, setSome } = setters();
|
|
15301
|
-
return foldEntries({
|
|
15302
|
-
entries: mappingOf(sink, "secret of workflow_call event")(entry),
|
|
15303
|
-
initial: { name: entry.key },
|
|
15304
|
-
handlers: [["description", set("description", entryText(sink)(true))], ["required", setSome("required", required(sink))]],
|
|
15305
|
-
unknown: rejecting({
|
|
15306
|
-
sink,
|
|
15307
|
-
section: "secrets",
|
|
15308
|
-
expected: ["description", "required"]
|
|
15309
|
-
})
|
|
15310
|
-
});
|
|
15311
|
-
};
|
|
15312
|
-
const callOutput = (sink) => (entry) => {
|
|
15313
|
-
const { set } = setters();
|
|
15314
|
-
const output = foldEntries({
|
|
15315
|
-
entries: mappingOf(sink, "output of workflow_call event")(entry),
|
|
15316
|
-
initial: { name: entry.key },
|
|
15317
|
-
handlers: [["description", set("description", entryText(sink)(true))], ["value", set("value", (item) => parseString(sink)(item.value, false))]],
|
|
15318
|
-
unknown: rejecting({
|
|
15319
|
-
sink,
|
|
15320
|
-
section: "outputs at workflow_call event",
|
|
15321
|
-
expected: ["description", "value"]
|
|
15322
|
-
})
|
|
15323
|
-
});
|
|
15324
|
-
reportMissing(sink)(output.value, entry.key, `"value" is missing at ${quote(entry.key.value)} output of workflow_call event`);
|
|
15325
|
-
return output;
|
|
15326
|
-
};
|
|
15327
|
-
const emptyCall = (at) => ({
|
|
15328
|
-
type: "workflow_call",
|
|
15329
|
-
inputs: [],
|
|
15330
|
-
outputs: {},
|
|
15331
|
-
line: at.line,
|
|
15332
|
-
column: at.column
|
|
15333
|
-
});
|
|
15334
|
-
const parseWorkflowCall = (sink) => (at, node) => {
|
|
15335
|
-
const { set } = setters();
|
|
15336
|
-
return foldEntries({
|
|
15337
|
-
entries: emptyableSection(sink)("workflow_call", node),
|
|
15338
|
-
initial: emptyCall(at),
|
|
15339
|
-
handlers: [
|
|
15340
|
-
["inputs", set("inputs", (entry) => Array$1.map(emptyableCaselessSection(sink)("inputs", entry.value), callInput(sink)))],
|
|
15341
|
-
["secrets", set("secrets", (entry) => entryRecord(callSecret(sink))(emptyableCaselessSection(sink)("secrets", entry.value)))],
|
|
15342
|
-
["outputs", set("outputs", (entry) => entryRecord(callOutput(sink))(emptyableCaselessSection(sink)("outputs", entry.value)))]
|
|
15343
|
-
],
|
|
15344
|
-
unknown: rejecting({
|
|
15345
|
-
sink,
|
|
15346
|
-
section: "workflow_call",
|
|
15347
|
-
expected: [
|
|
15348
|
-
"inputs",
|
|
15349
|
-
"secrets",
|
|
15350
|
-
"outputs"
|
|
15351
|
-
]
|
|
15352
|
-
})
|
|
15353
|
-
});
|
|
15354
|
-
};
|
|
15355
|
-
// src/app/presets/entities/workflow/lib/on.ts
|
|
15356
|
-
const withoutConfig = (sink) => (node) => {
|
|
15357
|
-
const name = parseString(sink)(node, false);
|
|
15358
|
-
switch (name.value) {
|
|
15359
|
-
case "": return Option.none();
|
|
15360
|
-
case "schedule":
|
|
15361
|
-
sink.error(node, "schedule event must be configured with mapping");
|
|
15362
|
-
return Option.none();
|
|
15363
|
-
case "repository_dispatch": return Option.some({
|
|
15364
|
-
type: "repository_dispatch",
|
|
15365
|
-
types: []
|
|
15366
|
-
});
|
|
15367
|
-
case "workflow_dispatch": return Option.some(emptyDispatch(node));
|
|
15368
|
-
case "workflow_call": return Option.some(emptyCall(node));
|
|
15369
|
-
case "image_version": return Option.some(EMPTY_IMAGE_VERSION);
|
|
15370
|
-
default: return Option.some({
|
|
15371
|
-
...emptyWebhook(name),
|
|
15372
|
-
line: node.line,
|
|
15373
|
-
column: node.column
|
|
15374
|
-
});
|
|
15375
|
-
}
|
|
15376
|
-
};
|
|
15377
|
-
const configured = (sink) => (entry) => {
|
|
15378
|
-
switch (entry.id) {
|
|
15379
|
-
case "schedule": return parseSchedule(sink)(entry.value);
|
|
15380
|
-
case "workflow_dispatch": return Option.some(parseWorkflowDispatch(sink)(entry.key, entry.value));
|
|
15381
|
-
case "repository_dispatch": return Option.some(parseRepositoryDispatch(sink)(entry.value));
|
|
15382
|
-
case "workflow_call": return Option.some(parseWorkflowCall(sink)(entry.key, entry.value));
|
|
15383
|
-
case "image_version": return Option.some(parseImageVersion(sink)(entry.value));
|
|
15384
|
-
default: return Option.some(parseWebhook(sink)(entry.key, entry.value));
|
|
15385
|
-
}
|
|
15386
|
-
};
|
|
15387
|
-
const each = (parse) => (items) => pipe(items, Array$1.flatMap((item) => Option.toArray(parse(item))));
|
|
15388
|
-
const parseEvents = (sink) => (node) => {
|
|
15389
|
-
if (node.kind === "scalar") return withoutConfig(sink)(node).pipe(Option.toArray, Option.some);
|
|
15390
|
-
if (node.kind === "mapping") {
|
|
15391
|
-
const entries = section$1(sink)("on", node);
|
|
15392
|
-
return Option.some(each(configured(sink))(entries));
|
|
15393
|
-
}
|
|
15394
|
-
if (node.kind === "sequence") {
|
|
15395
|
-
checkNotEmpty(sink)("on", node);
|
|
15396
|
-
return Option.some(each(withoutConfig(sink))(node.children));
|
|
15397
|
-
}
|
|
15398
|
-
sink.error(node, `"on" section value is expected to be mapping or sequence but found ${node.kind} node`);
|
|
15399
|
-
return Option.none();
|
|
15400
|
-
};
|
|
15401
|
-
// src/app/presets/entities/workflow/lib/parse.ts
|
|
15402
|
-
const WORKFLOW_KEYS = [
|
|
15403
|
-
"name",
|
|
15404
|
-
"run-name",
|
|
15405
|
-
"on",
|
|
15406
|
-
"permissions",
|
|
15407
|
-
"env",
|
|
15408
|
-
"defaults",
|
|
15409
|
-
"concurrency",
|
|
15410
|
-
"jobs"
|
|
15411
|
-
];
|
|
15412
|
-
const FIRST$2 = 1;
|
|
15413
|
-
const EMPTY_WORKFLOW = {};
|
|
15414
|
-
const parseRoot = (sink) => (root) => {
|
|
15415
|
-
const { set, setSome } = setters();
|
|
15416
|
-
const workflow = foldEntries({
|
|
15417
|
-
entries: section$1(sink)("workflow", root),
|
|
15418
|
-
initial: EMPTY_WORKFLOW,
|
|
15419
|
-
handlers: [
|
|
15420
|
-
["name", set("name", (entry) => parseString(sink)(entry.value, true))],
|
|
15421
|
-
["on", setSome("on", (entry) => parseEvents(sink)(entry.value))],
|
|
15422
|
-
["permissions", set("permissions", (entry) => parsePermissions(sink)(entry.value))],
|
|
15423
|
-
["env", set("env", (entry) => parseEnv(sink)(entry.value))],
|
|
15424
|
-
["defaults", set("defaults", (entry) => parseDefaults(sink)(entry.value))],
|
|
15425
|
-
["concurrency", set("concurrency", (entry) => parseConcurrency(sink)(entry.key, entry.value))],
|
|
15426
|
-
["jobs", set("jobs", (entry) => entryRecord((job) => parseJob(sink)(job.key, job.value))(caselessSection(sink)("jobs", entry.value)))],
|
|
15427
|
-
["run-name", set("runName", (entry) => parseString(sink)(entry.value, false))]
|
|
15428
|
-
],
|
|
15429
|
-
unknown: rejecting({
|
|
15430
|
-
sink,
|
|
15431
|
-
section: "workflow",
|
|
15432
|
-
expected: WORKFLOW_KEYS
|
|
15433
|
-
})
|
|
15434
|
-
});
|
|
15435
|
-
reportMissing(sink)(workflow.on, root, "\"on\" section is missing in workflow");
|
|
15436
|
-
reportMissing(sink)(workflow.jobs, root, "\"jobs\" section is missing in workflow");
|
|
15437
|
-
return workflow;
|
|
15438
|
-
};
|
|
15439
|
-
const parseWorkflow = (sink) => (source) => {
|
|
15440
|
-
for (const problem of source.errors) sink.error(problem, problem.message);
|
|
15441
|
-
const root = Option.fromNullishOr(source.yaml);
|
|
15442
|
-
if (Option.isSome(root)) return Option.some(parseRoot(sink)(root.value));
|
|
15443
|
-
if (pipe(source.errors, Array$1.some((problem) => String$1.startsWith("could not parse")(problem.message)))) return Option.none();
|
|
15444
|
-
sink.error({
|
|
15445
|
-
line: FIRST$2,
|
|
15446
|
-
column: FIRST$2
|
|
15447
|
-
}, "workflow is empty");
|
|
15448
|
-
return Option.some(EMPTY_WORKFLOW);
|
|
15449
|
-
};
|
|
15450
|
-
// src/app/presets/entities/workflow/model/parsed.ts
|
|
15451
|
-
const parsed = /* @__PURE__ */ new WeakMap();
|
|
15452
|
-
const parse = (source) => {
|
|
15453
|
-
const errors = [];
|
|
15454
|
-
const workflow = parseWorkflow({ error: (at, message) => {
|
|
15455
|
-
errors.push({
|
|
15456
|
-
line: at.line,
|
|
15457
|
-
column: at.column,
|
|
15458
|
-
message
|
|
15459
|
-
});
|
|
15460
|
-
} })(source);
|
|
15461
|
-
return {
|
|
15462
|
-
errors,
|
|
15463
|
-
...optional("workflow")(workflow)
|
|
15464
|
-
};
|
|
15465
|
-
};
|
|
15466
|
-
const workflowOf = (source) => parsed.getOrInsertComputed(source, () => parse(source));
|
|
15467
|
-
// src/app/presets/shared/project-cache/index.ts
|
|
15468
|
-
const projectCache = () => {
|
|
15469
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
15470
|
-
const entriesOf = (project) => cache.getOrInsertComputed(project, () => /* @__PURE__ */ new Map());
|
|
15471
|
-
return {
|
|
15472
|
-
get: (project) => (key) => Option.fromNullishOr(entriesOf(project).get(key)),
|
|
15473
|
-
set: (project) => (key, value) => {
|
|
15474
|
-
entriesOf(project).set(key, value);
|
|
15475
|
-
}
|
|
15476
|
-
};
|
|
15477
|
-
};
|
|
15478
|
-
// src/app/presets/shared/uses/index.ts
|
|
15479
|
-
const LOCAL = "./";
|
|
15480
|
-
const SELF_REPOSITORY = "$/";
|
|
15481
|
-
const localPath = (spec) => Option.orElse(afterPrefix(LOCAL)(spec), () => afterPrefix(SELF_REPOSITORY)(spec));
|
|
15482
|
-
const isSelfReferenceWithRef = (spec) => Option.exists(afterPrefix(SELF_REPOSITORY)(spec), String$1.includes("@"));
|
|
15483
|
-
const selfReferenceError = (spec) => `self repository reference ${quote(spec)} must not include @{ref}. "$/" always resolves to the commit of the running workflow. see https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsuses`;
|
|
15484
|
-
// src/app/presets/entities/workflow/model/reusable.ts
|
|
15485
|
-
const EMPTY_METADATA = {
|
|
15486
|
-
inputs: {},
|
|
15487
|
-
outputs: {},
|
|
15488
|
-
secrets: {}
|
|
15489
|
-
};
|
|
15490
|
-
// src/app/presets/entities/workflow/lib/reusable-sections.ts
|
|
15491
|
-
const KINDS = {
|
|
15492
|
-
boolean: "boolean",
|
|
15493
|
-
number: "number",
|
|
15494
|
-
string: "string"
|
|
15495
|
-
};
|
|
15496
|
-
const fieldsOf$2 = (sink, node) => ({
|
|
15497
|
-
required: flagAt(sink)("required")(node),
|
|
15498
|
-
defaulted: Option.exists(valueAt("default")(node), (value) => Option.isSome(decodeOptionalString(sink)(value))),
|
|
15499
|
-
type: Option.match(valueAt("type")(node), {
|
|
15500
|
-
onNone: () => "",
|
|
15501
|
-
onSome: decodeString(sink)
|
|
15502
|
-
})
|
|
15503
|
-
});
|
|
15504
|
-
const inputOf$1 = (sink) => (name, node) => {
|
|
15505
|
-
if (isNull(node)) return Option.some({
|
|
15506
|
-
name,
|
|
15507
|
-
required: false,
|
|
15508
|
-
kind: "any"
|
|
15509
|
-
});
|
|
15510
|
-
if (node.kind !== "mapping") {
|
|
15511
|
-
typeError(sink)(node, "actionlint.metadata");
|
|
15512
|
-
return Option.none();
|
|
15513
|
-
}
|
|
15514
|
-
let failed = false;
|
|
15515
|
-
const fields = fieldsOf$2((message) => {
|
|
15516
|
-
failed = true;
|
|
15517
|
-
sink(message);
|
|
15518
|
-
}, node);
|
|
15519
|
-
return pipe(Option.liftPredicate(fields, () => !failed), Option.map((found) => ({
|
|
15520
|
-
name,
|
|
15521
|
-
required: found.required && !found.defaulted,
|
|
15522
|
-
kind: Option.getOrElse(Record.get(KINDS, found.type), () => "any")
|
|
15523
|
-
})));
|
|
15524
|
-
};
|
|
15525
|
-
const inputsOf$1 = (sink) => (node) => {
|
|
15526
|
-
let out = {};
|
|
15527
|
-
if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.inputs")) return out;
|
|
15528
|
-
for (const { key, value } of pairsOf(node)) {
|
|
15529
|
-
const input = inputOf$1(sink)(key.value, value);
|
|
15530
|
-
if (Option.isNone(input)) return out;
|
|
15531
|
-
out = Record.set(out, lowerKey(key), input.value);
|
|
15532
|
-
}
|
|
15533
|
-
return out;
|
|
15534
|
-
};
|
|
15535
|
-
const secretRequired = (sink, node) => {
|
|
15536
|
-
if (!isPresent(sink)(node, "mapping", "actionlint.ReusableWorkflowMetadataSecret")) return Option.liftPredicate(false, () => isNull(node));
|
|
15537
|
-
let required = false;
|
|
15538
|
-
let failed = false;
|
|
15539
|
-
const local = (message) => {
|
|
15540
|
-
failed = true;
|
|
15541
|
-
sink(message);
|
|
15542
|
-
};
|
|
15543
|
-
for (const { key, value } of pairsOf(node)) if (key.value === "required") required = decodeBoolean(local)(value);
|
|
15544
|
-
return Option.liftPredicate(required, () => !failed);
|
|
15545
|
-
};
|
|
15546
|
-
const secretsOf = (sink) => (node) => {
|
|
15547
|
-
let out = {};
|
|
15548
|
-
if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.secrets")) return out;
|
|
15549
|
-
for (const { key, value } of pairsOf(node)) {
|
|
15550
|
-
const required = secretRequired(sink, value);
|
|
15551
|
-
if (Option.isNone(required)) return out;
|
|
15552
|
-
out = Record.set(out, lowerKey(key), {
|
|
15553
|
-
name: key.value,
|
|
15554
|
-
required: required.value
|
|
15555
|
-
});
|
|
15556
|
-
}
|
|
15557
|
-
return out;
|
|
15558
|
-
};
|
|
15559
|
-
const outputsOf$1 = (sink) => (node) => {
|
|
15560
|
-
if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.outputs")) return {};
|
|
15561
|
-
return Record.fromEntries(pipe(pairsOf(node), Array$1.map(({ key }) => [lowerKey(key), key.value])));
|
|
15562
|
-
};
|
|
15563
|
-
// src/app/presets/entities/workflow/lib/reusable.ts
|
|
15564
|
-
const CALL = "workflow_call";
|
|
15565
|
-
const isCall = (node) => String$1.toLowerCase(node.value) === CALL;
|
|
15566
|
-
const metadataOf$2 = (sink, node) => {
|
|
15567
|
-
if (!isPresent(sink)(node, "mapping", "actionlint.ReusableWorkflowMetadata")) return EMPTY_METADATA;
|
|
15568
|
-
const section = (key) => valueAt(key)(node);
|
|
15569
|
-
return {
|
|
15570
|
-
inputs: pipe(section("inputs"), Option.map(inputsOf$1(sink)), Option.getOrElse(() => ({}))),
|
|
15571
|
-
outputs: pipe(section("outputs"), Option.map(outputsOf$1(sink)), Option.getOrElse(() => ({}))),
|
|
15572
|
-
secrets: pipe(section("secrets"), Option.map(secretsOf(sink)), Option.getOrElse(() => ({})))
|
|
15573
|
-
};
|
|
15574
|
-
};
|
|
15575
|
-
const decodeCall = (node) => {
|
|
15576
|
-
const errors = [];
|
|
15577
|
-
const metadata = metadataOf$2((message) => {
|
|
15578
|
-
errors.push(message);
|
|
15579
|
-
}, node);
|
|
15580
|
-
if (Array$1.isReadonlyArrayEmpty(errors)) return Result.succeed(metadata);
|
|
15581
|
-
return Result.fail(`yaml: unmarshal errors:\n ${Array$1.join(errors, "\n ")}`);
|
|
15582
|
-
};
|
|
15583
|
-
const fromOn = (on) => {
|
|
15584
|
-
const call = pipe(pairsOf(on), Array$1.findFirst((pair) => isCall(pair.key)));
|
|
15585
|
-
if (on.kind === "mapping" && Option.isSome(call)) return decodeCall(call.value.value);
|
|
15586
|
-
if (on.kind === "scalar" && isCall(on) || on.kind === "sequence" && pipe(on.children, Array$1.some(isCall))) return Result.succeed(EMPTY_METADATA);
|
|
15587
|
-
return Result.fail(`"workflow_call" event trigger is not found in "on:" at line:${String(on.line)}, column:${String(on.column)}`);
|
|
15588
|
-
};
|
|
15589
|
-
const reusableOf = readYaml((source) => {
|
|
15590
|
-
const on = pipe(Option.fromNullishOr(source.yaml), Option.filter((root) => root.kind === "mapping"), Option.flatMap(valueAt("on")));
|
|
15591
|
-
if (Option.isNone(on)) return Result.fail("\"on:\" is not found");
|
|
15592
|
-
return fromOn(on.value);
|
|
15593
|
-
});
|
|
15594
|
-
// src/app/presets/entities/workflow/lib/local-workflows.ts
|
|
15595
|
-
const reusables = projectCache();
|
|
15596
|
-
const unreadable = (spec, relative) => Result.fail(`could not read reusable workflow file for ${quote(spec)}: open ${relative}: no such file or directory`);
|
|
15597
|
-
const load$1 = (project, spec, relative) => Option.match(project.parse(relative), {
|
|
15598
|
-
onNone: () => unreadable(spec, relative),
|
|
15599
|
-
onSome: (source) => Result.mapError(reusableOf(source), (message) => `error while parsing reusable workflow ${quote(spec)}: ${String$1.replaceAll("\n", " ")(message)}`)
|
|
15600
|
-
});
|
|
15601
|
-
const findReusable = (project) => (spec) => {
|
|
15602
|
-
const relative = Option.filter(localPath(spec), () => !containsExpression(spec));
|
|
15603
|
-
if (Option.isNone(relative)) return Option.none();
|
|
15604
|
-
const hit = reusables.get(project)(spec);
|
|
15605
|
-
if (Option.isSome(hit)) return hit.value;
|
|
15606
|
-
const loaded = Option.some(load$1(project, spec, relative.value));
|
|
15607
|
-
reusables.set(project)(spec, pipe(loaded, Option.filter((found) => Result.isSuccess(found))));
|
|
15608
|
-
return loaded;
|
|
15609
|
-
};
|
|
15610
|
-
const skipReusable = (project) => (spec) => {
|
|
15611
|
-
reusables.set(project)(spec, Option.none());
|
|
15612
|
-
};
|
|
15613
|
-
// src/app/presets/entities/workflow/lib/raw-compare.ts
|
|
15614
|
-
const sameProps = (compare, mine, theirs) => Record.size(mine) === Record.size(theirs) && pipe(Record.toEntries(mine), Array$1.every(([name, value]) => Option.exists(Record.get(theirs, name), (other) => compare(value)(other))));
|
|
15615
|
-
const sameElems = (compare, mine, theirs) => mine.length === theirs.length && pipe(Array$1.zip(mine, theirs), Array$1.every(([left, right]) => compare(left)(right)));
|
|
15616
|
-
const rawEquals = (left) => (right) => {
|
|
15617
|
-
if (left.type === "object" && right.type === "object") return sameProps(rawEquals, left.props, right.props);
|
|
15618
|
-
if (left.type === "array" && right.type === "array") return sameElems(rawEquals, left.elems, right.elems);
|
|
15619
|
-
return left.type === "string" && right.type === "string" && left.value === right.value;
|
|
15620
|
-
};
|
|
15621
|
-
const rawDescribe = (value) => {
|
|
15622
|
-
if (value.type === "object") {
|
|
15623
|
-
const parts = pipe(Record.toEntries(value.props), Array$1.map(([name, prop]) => `${quote(name)}: ${rawDescribe(prop)}`));
|
|
15624
|
-
return `{${Array$1.join(Array$1.sort(parts, Order.String), ", ")}}`;
|
|
15625
|
-
}
|
|
15626
|
-
if (value.type === "array") return `[${pipe(value.elems, Array$1.map(rawDescribe), Array$1.join(", "))}]`;
|
|
15627
|
-
return quote(value.value);
|
|
15628
|
-
};
|
|
15629
|
-
const isExpression = (value) => value.type === "string" && containsExpression(value.value);
|
|
15630
|
-
const objectSubset = (compare, value, sub) => value.type === "object" && sub.type === "object" && pipe(Record.toEntries(sub.props), Array$1.every(([name, each]) => Option.exists(Record.get(value.props, name), (prop) => compare(prop)(each))));
|
|
15631
|
-
const isSubset = (value) => (sub) => {
|
|
15632
|
-
if (isExpression(sub)) return true;
|
|
15633
|
-
if (value.type === "object") return objectSubset(isSubset, value, sub);
|
|
15634
|
-
if (value.type === "array") return sub.type === "array" && sameElems(isSubset, value.elems, sub.elems);
|
|
15635
|
-
return containsExpression(value.value) || rawEquals(value)(sub);
|
|
15636
|
-
};
|
|
15637
14145
|
// src/app/presets/features/check-workflows/lib/expression/scan.ts
|
|
15638
14146
|
const OPEN$2 = "${{";
|
|
15639
14147
|
const BASE = 1;
|
|
@@ -15667,7 +14175,7 @@ const checkNode = (env) => (site) => (expr, at) => {
|
|
|
15667
14175
|
return Option.liftPredicate(checked.type, () => Array$1.isReadonlyArrayEmpty(checked.errors));
|
|
15668
14176
|
};
|
|
15669
14177
|
const checkSource = (env) => (site) => (source, at) => {
|
|
15670
|
-
const parsed = parse
|
|
14178
|
+
const parsed = parse(source);
|
|
15671
14179
|
if (Result.isFailure(parsed.result)) {
|
|
15672
14180
|
report$1(env)(at)(parsed.result.failure);
|
|
15673
14181
|
return {
|
|
@@ -38515,7 +37023,7 @@ const embedded = (env, text, key) => {
|
|
|
38515
37023
|
return pipe(Array$1.head(typed), Option.filter(() => typed.length === SINGLE$7 && isExpressionAssigned(text.value)), Option.map((one) => one.type));
|
|
38516
37024
|
};
|
|
38517
37025
|
const bare = (env, text, key) => {
|
|
38518
|
-
const parsed = parse
|
|
37026
|
+
const parsed = parse(`${text.value}${CLOSE$1}`).result;
|
|
38519
37027
|
if (Result.isFailure(parsed)) {
|
|
38520
37028
|
report$1(env)(text)(parsed.failure);
|
|
38521
37029
|
return Option.none();
|
|
@@ -38868,46 +37376,6 @@ const expressionVisitor = ({ fail, context }) => {
|
|
|
38868
37376
|
}
|
|
38869
37377
|
};
|
|
38870
37378
|
};
|
|
38871
|
-
// src/app/presets/features/check-workflows/lib/workflow-rule.ts
|
|
38872
|
-
const NOOP = {
|
|
38873
|
-
workflowPre: Function.constVoid,
|
|
38874
|
-
jobPre: Function.constVoid,
|
|
38875
|
-
step: Function.constVoid,
|
|
38876
|
-
jobPost: Function.constVoid,
|
|
38877
|
-
workflowPost: Function.constVoid
|
|
38878
|
-
};
|
|
38879
|
-
const eachEvent = (check) => (workflow) => {
|
|
38880
|
-
for (const event of Option.getOrElse(Option.fromNullishOr(workflow.on), () => [])) check(event);
|
|
38881
|
-
};
|
|
38882
|
-
const visitJob = (visitor, job) => {
|
|
38883
|
-
visitor.jobPre(job);
|
|
38884
|
-
for (const step of Option.getOrElse(Option.fromNullishOr(job.steps), () => [])) visitor.step(step);
|
|
38885
|
-
visitor.jobPost(job);
|
|
38886
|
-
};
|
|
38887
|
-
const visit$1 = (visitor, workflow) => {
|
|
38888
|
-
visitor.workflowPre(workflow);
|
|
38889
|
-
for (const job of Record.values(Option.getOrElse(Option.fromNullishOr(workflow.jobs), () => ({})))) visitJob(visitor, job);
|
|
38890
|
-
visitor.workflowPost(workflow);
|
|
38891
|
-
};
|
|
38892
|
-
const workflowRule = (rule) => defineRule({
|
|
38893
|
-
meta: {
|
|
38894
|
-
description: rule.description,
|
|
38895
|
-
docs: rule.docs,
|
|
38896
|
-
kinds: ["workflow"]
|
|
38897
|
-
},
|
|
38898
|
-
check: (context) => {
|
|
38899
|
-
for (const workflow of Option.toArray(Option.fromNullishOr(workflowOf(context.source).workflow))) {
|
|
38900
|
-
const fail = (at, message) => {
|
|
38901
|
-
context.report({
|
|
38902
|
-
line: at.line,
|
|
38903
|
-
column: at.column,
|
|
38904
|
-
message
|
|
38905
|
-
});
|
|
38906
|
-
};
|
|
38907
|
-
visit$1(rule.visitor(fail, context), workflow);
|
|
38908
|
-
}
|
|
38909
|
-
}
|
|
38910
|
-
});
|
|
38911
37379
|
// src/app/presets/features/check-workflows/model/rules/expression.ts
|
|
38912
37380
|
const expression = workflowRule({
|
|
38913
37381
|
description: "Reports type errors, undefined properties and untrusted inputs in expressions",
|
|
@@ -39044,7 +37512,7 @@ const jobNeeds = workflowRule({
|
|
|
39044
37512
|
const OPEN$1 = 3;
|
|
39045
37513
|
const matrixProperty = (label) => {
|
|
39046
37514
|
if (!isExpressionAssigned(label.value)) return Option.none();
|
|
39047
|
-
const parsed = parse
|
|
37515
|
+
const parsed = parse(String$1.slice(OPEN$1)(String$1.trim(label.value))).result;
|
|
39048
37516
|
return pipe(Result.getSuccess(parsed), Option.flatMap((expr) => {
|
|
39049
37517
|
if (expr.type === "object-deref" && expr.receiver.type === "variable" && expr.receiver.name === "matrix") return Option.some(expr.property);
|
|
39050
37518
|
return Option.none();
|
|
@@ -41109,15 +39577,6 @@ const shown = (finding) => {
|
|
|
41109
39577
|
const code = CODES[finding.code];
|
|
41110
39578
|
return `shellcheck reported issue in this script: SC${String(code.number)}:${code.level}:${String(finding.line)}:${String(finding.column)}: ${messageOf(finding)}`;
|
|
41111
39579
|
};
|
|
41112
|
-
// src/app/presets/features/check-workflows/lib/step.ts
|
|
41113
|
-
const runOf = (step) => pipe(Option.fromNullishOr(step.exec), Option.flatMap((exec) => {
|
|
41114
|
-
if (exec.type === "run") return Option.some(exec);
|
|
41115
|
-
return Option.none();
|
|
41116
|
-
}));
|
|
41117
|
-
const actionOf = (step) => pipe(Option.fromNullishOr(step.exec), Option.flatMap((exec) => {
|
|
41118
|
-
if (exec.type === "action") return Option.some(exec);
|
|
41119
|
-
return Option.none();
|
|
41120
|
-
}));
|
|
41121
39580
|
// src/app/presets/features/check-workflows/model/rules/shell-name.ts
|
|
41122
39581
|
const SHELLS = {
|
|
41123
39582
|
unix: [
|
|
@@ -42572,7 +41031,7 @@ const START = 0;
|
|
|
42572
41031
|
const SINGLE = 2;
|
|
42573
41032
|
const checkExpression = (fail) => (at, input) => {
|
|
42574
41033
|
const trimmed = String$1.trim(input);
|
|
42575
|
-
if (pipe(parse
|
|
41034
|
+
if (pipe(parse(`${trimmed}${CLOSE}`).result, Result.getSuccess, Option.exists(isConstant))) fail(at, `constant expression ${quote(trimmed)} in condition. remove the if: section`);
|
|
42576
41035
|
};
|
|
42577
41036
|
const checkPlaceholder = (fail) => (condition, start, end) => {
|
|
42578
41037
|
const { value } = condition;
|
|
@@ -42746,7 +41205,12 @@ const zizmor = ({ concerns = ALL_CONCERNS, ...settings } = {}) => ({
|
|
|
42746
41205
|
...presetOf("zizmor", zizmorPlugin)(pipe(concerns, Array$1.flatMap((concern) => ZIZMOR_CONCERNS[concern]))),
|
|
42747
41206
|
settings: { zizmor: settings }
|
|
42748
41207
|
});
|
|
42749
|
-
const
|
|
42750
|
-
|
|
41208
|
+
const practices = () => presetOf("practices", practicesPlugin)(Record.keys(practicesPlugin.rules));
|
|
41209
|
+
const recommended = () => ({ extends: [
|
|
41210
|
+
actionlint(),
|
|
41211
|
+
zizmor(),
|
|
41212
|
+
practices()
|
|
41213
|
+
] });
|
|
41214
|
+
export { actionlint, practices, recommended, zizmor };
|
|
42751
41215
|
|
|
42752
41216
|
//# sourceMappingURL=presets.mjs.map
|