willfire 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/names/lookupPath.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export function lookupPath(obj, path) {
|
|
2
2
|
let cur = obj;
|
|
3
3
|
for (const seg of path.split(".")) {
|
|
4
|
-
if (cur
|
|
4
|
+
if (cur === null || typeof cur !== "object" || !(seg in cur)) {
|
|
5
5
|
return undefined;
|
|
6
|
+
}
|
|
6
7
|
cur = cur[seg];
|
|
7
8
|
}
|
|
8
9
|
return cur;
|
package/dist/names/renderName.js
CHANGED
|
@@ -17,8 +17,9 @@ export function renderName(template, combo) {
|
|
|
17
17
|
return formatMatrixValue(val);
|
|
18
18
|
}
|
|
19
19
|
// We only predict pull_request dispatch, so this one is knowable.
|
|
20
|
-
if (expr === "github.event_name")
|
|
20
|
+
if (expr === "github.event_name") {
|
|
21
21
|
return "pull_request";
|
|
22
|
+
}
|
|
22
23
|
resolved = false;
|
|
23
24
|
return whole;
|
|
24
25
|
});
|
|
@@ -3,15 +3,19 @@ export function getPrTrigger(wf) {
|
|
|
3
3
|
// YAML 1.1 parsers read `on` as boolean true; the `yaml` package (1.2)
|
|
4
4
|
// keeps it a string key. Handle both.
|
|
5
5
|
const on = wf["on"] ?? wf["true"];
|
|
6
|
-
if (on
|
|
6
|
+
if (on === null || on === undefined) {
|
|
7
7
|
return MISSING;
|
|
8
|
-
|
|
8
|
+
}
|
|
9
|
+
if (typeof on === "string") {
|
|
9
10
|
return on === "pull_request" ? {} : MISSING;
|
|
10
|
-
|
|
11
|
+
}
|
|
12
|
+
if (Array.isArray(on)) {
|
|
11
13
|
return on.includes("pull_request") ? {} : MISSING;
|
|
14
|
+
}
|
|
12
15
|
if (typeof on === "object") {
|
|
13
|
-
if ("pull_request" in on)
|
|
16
|
+
if ("pull_request" in on) {
|
|
14
17
|
return on["pull_request"] ?? {};
|
|
18
|
+
}
|
|
15
19
|
return MISSING;
|
|
16
20
|
}
|
|
17
21
|
return MISSING;
|
|
@@ -7,8 +7,9 @@ const DEFAULT_TYPES = ["opened", "synchronize", "reopened"];
|
|
|
7
7
|
// reusable workflow, unresolvable `if`), and that is a per-entry status.
|
|
8
8
|
export function workflowDispatches(wf, ctx) {
|
|
9
9
|
const trig = getPrTrigger(wf);
|
|
10
|
-
if (trig === MISSING)
|
|
10
|
+
if (trig === MISSING) {
|
|
11
11
|
return [false, "no pull_request trigger"];
|
|
12
|
+
}
|
|
12
13
|
const types = trig["types"] ?? DEFAULT_TYPES;
|
|
13
14
|
if (!types.includes(ctx.action)) {
|
|
14
15
|
return [false, `action '${ctx.action}' not in types [${types}]`];
|
package/dist/uses/parseUses.js
CHANGED
|
@@ -13,21 +13,25 @@ import { EXPRESSION_RE } from "../names/jobDisplayName.js";
|
|
|
13
13
|
* guess a fetch target for.
|
|
14
14
|
*/
|
|
15
15
|
export function parseUses(uses) {
|
|
16
|
-
if (EXPRESSION_RE.test(uses))
|
|
16
|
+
if (EXPRESSION_RE.test(uses)) {
|
|
17
17
|
return null;
|
|
18
|
+
}
|
|
18
19
|
if (uses.startsWith("./")) {
|
|
19
20
|
const path = uses.slice(2);
|
|
20
21
|
return path === "" ? null : { path, source: null };
|
|
21
22
|
}
|
|
22
23
|
const at = uses.lastIndexOf("@");
|
|
23
|
-
if (at <= 0)
|
|
24
|
+
if (at <= 0) {
|
|
24
25
|
return null;
|
|
26
|
+
}
|
|
25
27
|
const ref = uses.slice(at + 1);
|
|
26
|
-
if (ref === "")
|
|
28
|
+
if (ref === "") {
|
|
27
29
|
return null;
|
|
30
|
+
}
|
|
28
31
|
const [owner, repo, ...rest] = uses.slice(0, at).split("/");
|
|
29
32
|
const path = rest.join("/");
|
|
30
|
-
if (!owner || !repo || path === "")
|
|
33
|
+
if (!owner || !repo || path === "") {
|
|
31
34
|
return null;
|
|
35
|
+
}
|
|
32
36
|
return { path, source: { owner, repo, ref } };
|
|
33
37
|
}
|