willfire 0.1.17 → 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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * GitHub cuts a display name over 100 characters to 97 plus `...`. Verified
3
+ * on a live dispatch (dirsql PR #1013): the cap applies to the leaf name
4
+ * before any reusable-call prefixing, so it lives here, not on the entry.
5
+ */
6
+ export declare function capDisplayName(name: string): string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * GitHub cuts a display name over 100 characters to 97 plus `...`. Verified
3
+ * on a live dispatch (dirsql PR #1013): the cap applies to the leaf name
4
+ * before any reusable-call prefixing, so it lives here, not on the entry.
5
+ */
6
+ export function capDisplayName(name) {
7
+ return name.length > 100 ? `${name.slice(0, 97)}...` : name;
8
+ }
@@ -1,4 +1,5 @@
1
1
  import { matrixSuffix } from "../matrix/matrixSuffix.js";
2
+ import { capDisplayName } from "./capDisplayName.js";
2
3
  import { renderName } from "./renderName.js";
3
4
  /**
4
5
  * A `name:` that contains any `${{ }}` expression suppresses the matrix
@@ -17,9 +18,9 @@ export const EXPRESSION_RE = /\$\{\{/;
17
18
  export function jobDisplayName(jobId, job, combo) {
18
19
  const raw = job != null && job.name != null ? String(job.name) : null;
19
20
  if (raw === null) {
20
- return { name: jobId + (combo ? matrixSuffix(combo) : ""), resolved: true };
21
+ return { name: capDisplayName(jobId + (combo ? matrixSuffix(combo) : "")), resolved: true };
21
22
  }
22
23
  const { text, resolved } = renderName(raw, combo?.values ?? null);
23
24
  const suffix = combo && !EXPRESSION_RE.test(raw) ? matrixSuffix(combo) : "";
24
- return { name: text + suffix, resolved };
25
+ return { name: capDisplayName(text + suffix), resolved };
25
26
  }
@@ -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 == null || typeof cur !== "object" || !(seg in 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;
@@ -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
  });
@@ -1,3 +1,4 @@
1
+ import { capDisplayName } from "./capDisplayName.js";
1
2
  /**
2
3
  * The check name a job gets when it is skipped.
3
4
  *
@@ -12,5 +13,5 @@
12
13
  */
13
14
  export function skippedDisplayName(jobId, job) {
14
15
  const raw = job != null && job.name != null ? String(job.name) : null;
15
- return { name: raw ?? jobId, resolved: true };
16
+ return { name: capDisplayName(raw ?? jobId), resolved: true };
16
17
  }
@@ -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 == null)
6
+ if (on === null || on === undefined) {
7
7
  return MISSING;
8
- if (typeof on === "string")
8
+ }
9
+ if (typeof on === "string") {
9
10
  return on === "pull_request" ? {} : MISSING;
10
- if (Array.isArray(on))
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}]`];
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willfire",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Predict the set of CI check entries GitHub Actions will create for a pull request",
5
5
  "license": "MIT",
6
6
  "packageManager": "pnpm@10.33.0",