actions-up 1.14.0 → 1.14.2

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.
Files changed (65) hide show
  1. package/dist/cli/build-json-report.js +18 -18
  2. package/dist/cli/index.js +101 -101
  3. package/dist/cli/merge-scan-results.js +2 -2
  4. package/dist/cli/normalize-update-mode.js +2 -2
  5. package/dist/cli/normalize-update-style.js +2 -2
  6. package/dist/cli/print-mode-warning.js +5 -5
  7. package/dist/cli/print-skipped-warning.js +7 -7
  8. package/dist/cli/resolve-scan-directories.js +8 -8
  9. package/dist/cli/validate-cli-options.js +2 -2
  10. package/dist/core/api/check-updates.js +114 -113
  11. package/dist/core/api/create-github-client.js +26 -26
  12. package/dist/core/api/get-all-releases.js +12 -12
  13. package/dist/core/api/get-all-tags.js +4 -4
  14. package/dist/core/api/get-compatible-update.js +6 -6
  15. package/dist/core/api/get-latest-release.js +15 -15
  16. package/dist/core/api/get-reference-type.js +5 -5
  17. package/dist/core/api/get-tag-info.js +14 -14
  18. package/dist/core/api/get-tag-sha.js +7 -7
  19. package/dist/core/api/internal-rate-limit-error.js +2 -2
  20. package/dist/core/api/make-request.js +4 -4
  21. package/dist/core/api/resolve-github-token-sync.js +7 -7
  22. package/dist/core/api/update-rate-limit-info.js +3 -6
  23. package/dist/core/ast/guards/has-range.js +2 -2
  24. package/dist/core/ast/guards/is-node.js +2 -2
  25. package/dist/core/ast/guards/is-pair.js +2 -2
  26. package/dist/core/ast/guards/is-scalar.js +2 -2
  27. package/dist/core/ast/guards/is-yaml-map.js +2 -2
  28. package/dist/core/ast/guards/is-yaml-sequence.js +2 -2
  29. package/dist/core/ast/scanners/scan-composite-action-ast.js +13 -13
  30. package/dist/core/ast/scanners/scan-workflow-ast.js +21 -21
  31. package/dist/core/ast/update/apply-updates.js +24 -24
  32. package/dist/core/ast/utils/extract-uses-from-steps.js +14 -14
  33. package/dist/core/ast/utils/find-map-pair.js +6 -6
  34. package/dist/core/ast/utils/get-line-number.js +4 -4
  35. package/dist/core/constants.js +2 -2
  36. package/dist/core/filters/parse-exclude-patterns.js +2 -2
  37. package/dist/core/fs/find-yaml-files-recursive.js +9 -9
  38. package/dist/core/fs/is-yaml-file.js +2 -2
  39. package/dist/core/fs/read-yaml-document.js +6 -6
  40. package/dist/core/ignore/should-ignore.js +4 -4
  41. package/dist/core/index.js +5 -5
  42. package/dist/core/interactive/format-version.js +14 -14
  43. package/dist/core/interactive/pad-string.js +4 -4
  44. package/dist/core/interactive/prompt-update-selection.js +153 -138
  45. package/dist/core/interactive/strip-ansi.js +2 -2
  46. package/dist/core/parsing/parse-action-reference.js +2 -2
  47. package/dist/core/scan-action-file.js +6 -6
  48. package/dist/core/scan-github-actions.js +83 -83
  49. package/dist/core/scan-recursive.js +24 -24
  50. package/dist/core/scan-workflow-file.js +6 -6
  51. package/dist/core/schema/composite/is-composite-action-runs.js +2 -2
  52. package/dist/core/schema/composite/is-composite-action-structure.js +2 -2
  53. package/dist/core/schema/workflow/is-workflow-structure.js +2 -2
  54. package/dist/core/updates/resolve-target-reference.js +26 -15
  55. package/dist/core/versions/find-compatible-tag.js +16 -16
  56. package/dist/core/versions/get-update-level.js +8 -8
  57. package/dist/core/versions/is-semver-like.js +2 -2
  58. package/dist/core/versions/is-sha.js +2 -2
  59. package/dist/core/versions/normalize-version.js +4 -4
  60. package/dist/core/versions/preserve-tag-format.d.ts +17 -0
  61. package/dist/core/versions/preserve-tag-format.js +11 -0
  62. package/dist/core/versions/read-inline-version-comment.js +4 -4
  63. package/dist/package.js +2 -2
  64. package/package.json +3 -3
  65. package/readme.md +8 -6
@@ -1,20 +1,20 @@
1
- import { makeRequest } from "./make-request.js";
2
- import { GitHubRateLimitError } from "./internal-rate-limit-error.js";
3
- async function getTagSha(n, r) {
1
+ import { makeRequest as e } from "./make-request.js";
2
+ import { GitHubRateLimitError as t } from "./internal-rate-limit-error.js";
3
+ async function n(n, r) {
4
4
  let { owner: i, repo: a, tag: o } = r, s = o.replace(/^refs\/tags\//u, ""), c = `${i}/${a}#${s}`;
5
5
  if (n.caches.tagSha.has(c)) return n.caches.tagSha.get(c) ?? null;
6
6
  try {
7
- let t = (await makeRequest(n, `/repos/${i}/${a}/git/refs/tags/${s}`)).data, r = t.object.sha, o = t.object.type, l = null;
7
+ let t = (await e(n, `/repos/${i}/${a}/git/refs/tags/${s}`)).data, r = t.object.sha, o = t.object.type, l = null;
8
8
  if (r && o === "tag") try {
9
- l = (await makeRequest(n, `/repos/${i}/${a}/git/tags/${r}`)).data.object.sha ?? null;
9
+ l = (await e(n, `/repos/${i}/${a}/git/tags/${r}`)).data.object.sha ?? null;
10
10
  } catch {
11
11
  l = r;
12
12
  }
13
13
  else r && o === "commit" && (l = r);
14
14
  return n.caches.tagSha.set(c, l), l;
15
15
  } catch (e) {
16
- if (e instanceof Error && e.message.includes("rate limit")) throw new GitHubRateLimitError(n.rateLimitReset);
16
+ if (e instanceof Error && e.message.includes("rate limit")) throw new t(n.rateLimitReset);
17
17
  return n.caches.tagSha.set(c, null), null;
18
18
  }
19
19
  }
20
- export { getTagSha };
20
+ export { n as getTagSha };
@@ -1,7 +1,7 @@
1
- var GitHubRateLimitError = class extends Error {
1
+ var e = class extends Error {
2
2
  constructor(e) {
3
3
  let t = e.toLocaleTimeString();
4
4
  super(`GitHub API rate limit exceeded. Resets at ${t}`), this.name = "GitHubRateLimitError";
5
5
  }
6
6
  };
7
- export { GitHubRateLimitError };
7
+ export { e as GitHubRateLimitError };
@@ -1,5 +1,5 @@
1
- import { updateRateLimitInfo } from "./update-rate-limit-info.js";
2
- async function makeRequest(t, n, r = {}) {
1
+ import { updateRateLimitInfo as e } from "./update-rate-limit-info.js";
2
+ async function t(t, n, r = {}) {
3
3
  let i = {
4
4
  Accept: "application/vnd.github.v3+json",
5
5
  "User-Agent": "actions-up",
@@ -11,7 +11,7 @@ async function makeRequest(t, n, r = {}) {
11
11
  headers: i
12
12
  }), o = {};
13
13
  for (let [e, t] of a.headers.entries()) o[e] = t;
14
- if (updateRateLimitInfo(t, o), !a.ok) {
14
+ if (e(t, o), !a.ok) {
15
15
  let e = /* @__PURE__ */ Error(`GitHub API error: ${a.status} ${a.statusText}`);
16
16
  if (e.status = a.status, a.status === 403) {
17
17
  let t = await a.text();
@@ -24,4 +24,4 @@ async function makeRequest(t, n, r = {}) {
24
24
  data: await a.json()
25
25
  };
26
26
  }
27
- export { makeRequest };
27
+ export { t as makeRequest };
@@ -1,13 +1,13 @@
1
- import { join } from "node:path";
2
- import { execFileSync } from "node:child_process";
3
- import { readFileSync } from "node:fs";
4
- function resolveGitHubTokenSync() {
1
+ import { join as e } from "node:path";
2
+ import { execFileSync as t } from "node:child_process";
3
+ import { readFileSync as n } from "node:fs";
4
+ function r() {
5
5
  let r = process.env.GITHUB_TOKEN;
6
6
  if (r && r.trim() !== "") return r.trim();
7
7
  let i = process.env.GH_TOKEN;
8
8
  if (i && i.trim() !== "") return i.trim();
9
9
  try {
10
- let e = execFileSync("gh", ["auth", "token"], {
10
+ let e = t("gh", ["auth", "token"], {
11
11
  stdio: [
12
12
  "ignore",
13
13
  "pipe",
@@ -19,7 +19,7 @@ function resolveGitHubTokenSync() {
19
19
  if (e) return e;
20
20
  } catch {}
21
21
  try {
22
- let t = readFileSync(join(process.cwd(), ".git", "config"), "utf8"), r = t.match(/^\s*(?:github\.(?:oauth-token|token)|hub\.oauthtoken)\s*=\s*(?<token>\S[^\n\r]*)$/mu)?.groups?.token?.trim();
22
+ let t = n(e(process.cwd(), ".git", "config"), "utf8"), r = t.match(/^\s*(?:github\.(?:oauth-token|token)|hub\.oauthtoken)\s*=\s*(?<token>\S[^\n\r]*)$/mu)?.groups?.token?.trim();
23
23
  if (r) return r;
24
24
  let i = null;
25
25
  for (let e of t.split(/\r?\n/u)) {
@@ -39,4 +39,4 @@ function resolveGitHubTokenSync() {
39
39
  }
40
40
  } catch {}
41
41
  }
42
- export { resolveGitHubTokenSync };
42
+ export { r as resolveGitHubTokenSync };
@@ -1,10 +1,7 @@
1
- function updateRateLimitInfo(e, t) {
1
+ function e(e, t) {
2
2
  let n = t["x-ratelimit-remaining"];
3
3
  n !== void 0 && (e.rateLimitRemaining = typeof n == "string" ? Number.parseInt(n, 10) : n);
4
4
  let r = t["x-ratelimit-reset"];
5
- if (r !== void 0) {
6
- let t = typeof r == "string" ? Number.parseInt(r, 10) : r;
7
- e.rateLimitReset = /* @__PURE__ */ new Date(t * 1e3);
8
- }
5
+ r !== void 0 && (e.rateLimitReset = /* @__PURE__ */ new Date((typeof r == "string" ? Number.parseInt(r, 10) : r) * 1e3));
9
6
  }
10
- export { updateRateLimitInfo };
7
+ export { e as updateRateLimitInfo };
@@ -1,4 +1,4 @@
1
- function hasRange(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "range" in e;
3
3
  }
4
- export { hasRange };
4
+ export { e as hasRange };
@@ -1,4 +1,4 @@
1
- function isNode(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "toJSON" in e && typeof e.toJSON == "function";
3
3
  }
4
- export { isNode };
4
+ export { e as isNode };
@@ -1,4 +1,4 @@
1
- function isPair(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "key" in e && "value" in e;
3
3
  }
4
- export { isPair };
4
+ export { e as isPair };
@@ -1,4 +1,4 @@
1
- function isScalar(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "value" in e;
3
3
  }
4
- export { isScalar };
4
+ export { e as isScalar };
@@ -1,4 +1,4 @@
1
- function isYAMLMap(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "items" in e && Array.isArray(e.items);
3
3
  }
4
- export { isYAMLMap };
4
+ export { e as isYAMLMap };
@@ -1,4 +1,4 @@
1
- function isYAMLSequence(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "items" in e && Array.isArray(e.items);
3
3
  }
4
- export { isYAMLSequence };
4
+ export { e as isYAMLSequence };
@@ -1,20 +1,20 @@
1
- import { isCompositeActionStructure } from "../../schema/composite/is-composite-action-structure.js";
2
- import { isCompositeActionRuns } from "../../schema/composite/is-composite-action-runs.js";
3
- import { isYAMLMap } from "../guards/is-yaml-map.js";
4
- import { extractUsesFromSteps } from "../utils/extract-uses-from-steps.js";
5
- import { findMapPair } from "../utils/find-map-pair.js";
6
- function scanCompositeActionAst(a, o, s) {
1
+ import { isCompositeActionStructure as e } from "../../schema/composite/is-composite-action-structure.js";
2
+ import { isCompositeActionRuns as t } from "../../schema/composite/is-composite-action-runs.js";
3
+ import { isYAMLMap as n } from "../guards/is-yaml-map.js";
4
+ import { extractUsesFromSteps as r } from "../utils/extract-uses-from-steps.js";
5
+ import { findMapPair as i } from "../utils/find-map-pair.js";
6
+ function a(a, o, s) {
7
7
  let c = a.toJSON();
8
- if (!isCompositeActionStructure(c) || !a.contents || !isYAMLMap(a.contents)) return [];
9
- let l = findMapPair(a.contents, "runs");
10
- if (!l?.value || !isYAMLMap(l.value)) return [];
8
+ if (!e(c) || !a.contents || !n(a.contents)) return [];
9
+ let l = i(a.contents, "runs");
10
+ if (!l?.value || !n(l.value)) return [];
11
11
  let u = c.runs;
12
- if (!u || !isCompositeActionRuns(u) || !u.steps || !Array.isArray(u.steps)) return [];
13
- let d = findMapPair(l.value, "steps");
14
- return d?.value ? extractUsesFromSteps({
12
+ if (!u || !t(u) || !u.steps || !Array.isArray(u.steps)) return [];
13
+ let d = i(l.value, "steps");
14
+ return d?.value ? r({
15
15
  stepsNode: d.value,
16
16
  filePath: s,
17
17
  content: o
18
18
  }) : [];
19
19
  }
20
- export { scanCompositeActionAst };
20
+ export { a as scanCompositeActionAst };
@@ -1,26 +1,26 @@
1
- import { parseActionReference } from "../../parsing/parse-action-reference.js";
2
- import { getLineNumberForKey } from "../utils/get-line-number.js";
3
- import { isYAMLMap } from "../guards/is-yaml-map.js";
4
- import { isScalar } from "../guards/is-scalar.js";
5
- import { isNode } from "../guards/is-node.js";
6
- import { isPair } from "../guards/is-pair.js";
7
- import { extractUsesFromSteps } from "../utils/extract-uses-from-steps.js";
8
- import { findMapPair } from "../utils/find-map-pair.js";
9
- import { isWorkflowStructure } from "../../schema/workflow/is-workflow-structure.js";
10
- function scanWorkflowAst(l, u, d) {
11
- if (!isWorkflowStructure(l.toJSON()) || !l.contents || !isYAMLMap(l.contents)) return [];
12
- let f = findMapPair(l.contents, "jobs");
13
- if (!f?.value || !isYAMLMap(f.value)) return [];
1
+ import { parseActionReference as e } from "../../parsing/parse-action-reference.js";
2
+ import { getLineNumberForKey as t } from "../utils/get-line-number.js";
3
+ import { isYAMLMap as n } from "../guards/is-yaml-map.js";
4
+ import { isScalar as r } from "../guards/is-scalar.js";
5
+ import { isNode as i } from "../guards/is-node.js";
6
+ import { isPair as a } from "../guards/is-pair.js";
7
+ import { extractUsesFromSteps as o } from "../utils/extract-uses-from-steps.js";
8
+ import { findMapPair as s } from "../utils/find-map-pair.js";
9
+ import { isWorkflowStructure as c } from "../../schema/workflow/is-workflow-structure.js";
10
+ function l(l, u, d) {
11
+ if (!c(l.toJSON()) || !l.contents || !n(l.contents)) return [];
12
+ let f = s(l.contents, "jobs");
13
+ if (!f?.value || !n(f.value)) return [];
14
14
  let p = [];
15
15
  for (let c of f.value.items) {
16
- if (!isPair(c) || !c.value || !isNode(c.value) || !isYAMLMap(c.value)) continue;
17
- let l = isScalar(c.key) ? String(c.key.value) : void 0, f = findMapPair(c.value, "uses");
18
- if (f?.value && f.key && isScalar(f.value)) {
19
- let s = parseActionReference(String(f.value.value), d, getLineNumberForKey(u, f.key));
20
- s && (l && (s.job = l), p.push(s));
16
+ if (!a(c) || !c.value || !i(c.value) || !n(c.value)) continue;
17
+ let l = r(c.key) ? String(c.key.value) : void 0, f = s(c.value, "uses");
18
+ if (f?.value && f.key && r(f.value)) {
19
+ let n = e(String(f.value.value), d, t(u, f.key));
20
+ n && (l && (n.job = l), p.push(n));
21
21
  }
22
- let m = findMapPair(c.value, "steps");
23
- m?.value && p.push(...extractUsesFromSteps({
22
+ let m = s(c.value, "steps");
23
+ m?.value && p.push(...o({
24
24
  stepsNode: m.value,
25
25
  filePath: d,
26
26
  content: u,
@@ -29,4 +29,4 @@ function scanWorkflowAst(l, u, d) {
29
29
  }
30
30
  return p;
31
31
  }
32
- export { scanWorkflowAst };
32
+ export { l as scanWorkflowAst };
@@ -1,21 +1,21 @@
1
- import { readFile, writeFile } from "node:fs/promises";
2
- async function applyUpdates(r) {
1
+ import { readFile as e, writeFile as t } from "node:fs/promises";
2
+ async function n(n) {
3
3
  let i = /* @__PURE__ */ new Map();
4
- for (let e of r) {
5
- let { file: n } = e.action;
6
- if (!n) continue;
7
- let r = i.get(n) ?? [];
8
- r.push(e), i.set(n, r);
4
+ for (let e of n) {
5
+ let { file: t } = e.action;
6
+ if (!t) continue;
7
+ let n = i.get(t) ?? [];
8
+ n.push(e), i.set(t, n);
9
9
  }
10
- let a = [...i.entries()].map(async ([r, i]) => {
11
- let a = await readFile(r, "utf8");
10
+ let a = [...i.entries()].map(async ([n, i]) => {
11
+ let a = await e(n, "utf8");
12
12
  for (let e of i) {
13
- let n = e.targetRef ?? e.latestSha, r = e.targetRefStyle ?? (e.latestSha ? "sha" : null);
14
- if (!n || !r) continue;
13
+ let t = e.targetRef ?? e.latestSha, n = e.targetRefStyle ?? (e.latestSha ? "sha" : null);
14
+ if (!t || !n) continue;
15
15
  function i(e) {
16
16
  return e.replaceAll(/[$()*+\-./?[\\\]^{|}]/gu, String.raw`\$&`);
17
17
  }
18
- let o = i(e.action.name), s = e.currentVersion ? i(e.currentVersion) : "";
18
+ let o = i(e.action.name), s = e.currentVersion ? i(e.currentVersion) : "", c = s ? String.raw`(?=(?:['"]|[ \t\]}{,#]|$))` : "";
19
19
  if (o.includes("\n") || o.includes("\r")) {
20
20
  console.error(`Invalid action name: ${e.action.name}`);
21
21
  continue;
@@ -24,30 +24,30 @@ async function applyUpdates(r) {
24
24
  console.error(`Invalid version: ${e.currentVersion}`);
25
25
  continue;
26
26
  }
27
- if (n.includes("\n") || n.includes("\r") || n.trim() === "") {
28
- console.error(`Invalid target ref: ${n}`);
27
+ if (t.includes("\n") || t.includes("\r") || t.trim() === "") {
28
+ console.error(`Invalid target ref: ${t}`);
29
29
  continue;
30
30
  }
31
- if (r === "sha" && !/^[\da-f]{40}$/iu.test(n)) {
32
- console.error(`Invalid SHA format: ${n}`);
31
+ if (n === "sha" && !/^[\da-f]{40}$/iu.test(t)) {
32
+ console.error(`Invalid SHA format: ${t}`);
33
33
  continue;
34
34
  }
35
- let c = String.raw`['"]?\buses\b['"]?\s*:\s*`, l = String.raw`(?:^[^\S\n]*(?:-[^\S\n]*)?|[{\[,][^\S\n]*)` + c, u = new RegExp(String.raw`(?<prefix>${l})` + String.raw`(?<quote>['"]?)` + String.raw`(?<name>${o})@${s}` + String.raw`\k<quote>` + String.raw`(?<after>[ \t\]}{,]*)` + String.raw`(?<comment>[^\S\r\n]*#[^\r\n]*)?`, "gm");
36
- a = a.replace(u, (i, ...a) => {
35
+ let l = String.raw`['"]?\buses\b['"]?\s*:\s*`, u = String.raw`(?:^[^\S\n]*(?:-[^\S\n]*)?|[{\[,][^\S\n]*)` + l, d = new RegExp(String.raw`(?<prefix>${u})` + String.raw`(?<quote>['"]?)` + String.raw`(?<name>${o})@${s}${c}` + String.raw`\k<quote>` + String.raw`(?<after>[ \t\]}{,]*)` + String.raw`(?<comment>[^\S\r\n]*#[^\r\n]*)?`, "gm");
36
+ a = a.replace(d, (i, ...a) => {
37
37
  let o = a.at(-3), c = a.at(-2), l = a.at(-1), u = c.indexOf("\n", o + i.length), d = (u === -1 ? c.slice(o + i.length) : c.slice(o + i.length, u)).trim().length > 0, f = l.after.endsWith(" ") ? "" : " ", p = "";
38
- if (r === "sha") p = d && !l.comment && s !== "" ? "" : `${f}# ${e.latestVersion}`;
39
- else if (l.comment && !looksLikeInlineVersionComment(l.comment)) {
38
+ if (n === "sha") p = d && !l.comment && s !== "" ? "" : `${f}# ${e.latestVersion}`;
39
+ else if (l.comment && !r(l.comment)) {
40
40
  let { comment: e } = l;
41
41
  p = e;
42
42
  }
43
- return `${`${l.prefix}${l.quote}${l.name}`}@${`${n}${l.quote}${l.after}${p}`}`;
43
+ return `${`${l.prefix}${l.quote}${l.name}`}@${`${t}${l.quote}${l.after}${p}`}`;
44
44
  });
45
45
  }
46
- await writeFile(r, a, "utf8");
46
+ await t(n, a, "utf8");
47
47
  });
48
48
  await Promise.all(a);
49
49
  }
50
- function looksLikeInlineVersionComment(e) {
50
+ function r(e) {
51
51
  return /^#\s*[Vv]?\d+(?:\.\d+){0,2}(?:[+-][\w\-.]+)?\s*$/u.test(e.trim());
52
52
  }
53
- export { applyUpdates };
53
+ export { n as applyUpdates };
@@ -1,23 +1,23 @@
1
- import { parseActionReference } from "../../parsing/parse-action-reference.js";
2
- import { isYAMLSequence } from "../guards/is-yaml-sequence.js";
3
- import { getLineNumberForKey } from "./get-line-number.js";
4
- import { isYAMLMap } from "../guards/is-yaml-map.js";
5
- import { isScalar } from "../guards/is-scalar.js";
6
- import { isNode } from "../guards/is-node.js";
7
- import { isPair } from "../guards/is-pair.js";
8
- function extractUsesFromSteps(s) {
1
+ import { parseActionReference as e } from "../../parsing/parse-action-reference.js";
2
+ import { isYAMLSequence as t } from "../guards/is-yaml-sequence.js";
3
+ import { getLineNumberForKey as n } from "./get-line-number.js";
4
+ import { isYAMLMap as r } from "../guards/is-yaml-map.js";
5
+ import { isScalar as i } from "../guards/is-scalar.js";
6
+ import { isNode as a } from "../guards/is-node.js";
7
+ import { isPair as o } from "../guards/is-pair.js";
8
+ function s(s) {
9
9
  let { stepsNode: c, filePath: l, content: u, jobName: d } = s;
10
- if (!isYAMLSequence(c)) return [];
10
+ if (!t(c)) return [];
11
11
  let f = [];
12
- for (let o of c.items) {
13
- if (!isYAMLMap(o) || !isNode(o)) continue;
14
- let s = o.toJSON();
12
+ for (let t of c.items) {
13
+ if (!r(t) || !a(t)) continue;
14
+ let s = t.toJSON();
15
15
  if (typeof s != "object" || !s || Array.isArray(s)) continue;
16
16
  let c = s;
17
17
  if (typeof c.uses != "string") continue;
18
- let p = o.items.find((e) => isPair(e) && isScalar(e.key) && e.key.value === "uses"), m = p?.key ? getLineNumberForKey(u, p.key) : 0, h = parseActionReference(c.uses, l, m);
18
+ let p = t.items.find((e) => o(e) && i(e.key) && e.key.value === "uses"), m = p?.key ? n(u, p.key) : 0, h = e(c.uses, l, m);
19
19
  h && (d && (h.job = d), f.push(h));
20
20
  }
21
21
  return f;
22
22
  }
23
- export { extractUsesFromSteps };
23
+ export { s as extractUsesFromSteps };
@@ -1,7 +1,7 @@
1
- import { isYAMLMap } from "../guards/is-yaml-map.js";
2
- import { isScalar } from "../guards/is-scalar.js";
3
- import { isPair } from "../guards/is-pair.js";
4
- function findMapPair(r, i) {
5
- return !isYAMLMap(r) || !Array.isArray(r.items) ? null : r.items.find((e) => isPair(e) && isScalar(e.key) && e.key.value === i) ?? null;
1
+ import { isYAMLMap as e } from "../guards/is-yaml-map.js";
2
+ import { isScalar as t } from "../guards/is-scalar.js";
3
+ import { isPair as n } from "../guards/is-pair.js";
4
+ function r(r, i) {
5
+ return !e(r) || !Array.isArray(r.items) ? null : r.items.find((e) => n(e) && t(e.key) && e.key.value === i) ?? null;
6
6
  }
7
- export { findMapPair };
7
+ export { r as findMapPair };
@@ -1,9 +1,9 @@
1
- import { hasRange } from "../guards/has-range.js";
2
- function getLineNumberForKey(t, n) {
3
- if (hasRange(n) && n.range) {
1
+ import { hasRange as e } from "../guards/has-range.js";
2
+ function t(t, n) {
3
+ if (e(n) && n.range) {
4
4
  let [e] = n.range;
5
5
  if (typeof e == "number" && Number.isFinite(e)) return t.slice(0, Math.max(0, e)).split("\n").length;
6
6
  }
7
7
  return 0;
8
8
  }
9
- export { getLineNumberForKey };
9
+ export { t as getLineNumberForKey };
@@ -1,2 +1,2 @@
1
- const GITHUB_DIRECTORY = ".github", WORKFLOWS_DIRECTORY = "workflows", ACTIONS_DIRECTORY = "actions";
2
- export { ACTIONS_DIRECTORY, GITHUB_DIRECTORY, WORKFLOWS_DIRECTORY };
1
+ var e = ".github", t = "workflows", n = "actions";
2
+ export { n as ACTIONS_DIRECTORY, e as GITHUB_DIRECTORY, t as WORKFLOWS_DIRECTORY };
@@ -1,4 +1,4 @@
1
- function parseExcludePatterns(e) {
1
+ function e(e) {
2
2
  let t = [];
3
3
  for (let n of e) {
4
4
  let e = n.trim();
@@ -20,4 +20,4 @@ function parseExcludePatterns(e) {
20
20
  }
21
21
  return t;
22
22
  }
23
- export { parseExcludePatterns };
23
+ export { e as parseExcludePatterns };
@@ -1,20 +1,20 @@
1
- import { isYamlFile } from "./is-yaml-file.js";
2
- import { join } from "node:path";
3
- import { lstat, readdir } from "node:fs/promises";
4
- async function findYamlFilesRecursive(i) {
1
+ import { isYamlFile as e } from "./is-yaml-file.js";
2
+ import { join as t } from "node:path";
3
+ import { lstat as n, readdir as r } from "node:fs/promises";
4
+ async function i(i) {
5
5
  let a = [], o = /* @__PURE__ */ new Set();
6
6
  async function s(i) {
7
- if ((await lstat(i)).isSymbolicLink() || o.has(i)) return;
7
+ if ((await n(i)).isSymbolicLink() || o.has(i)) return;
8
8
  o.add(i);
9
- let c = (await readdir(i)).map(async (r) => {
9
+ let c = (await r(i)).map(async (r) => {
10
10
  try {
11
- let o = join(i, r), c = await lstat(o);
11
+ let o = t(i, r), c = await n(o);
12
12
  if (c.isSymbolicLink()) return;
13
- c.isDirectory() ? await s(o) : c.isFile() && isYamlFile(r) && a.push(o);
13
+ c.isDirectory() ? await s(o) : c.isFile() && e(r) && a.push(o);
14
14
  } catch {}
15
15
  });
16
16
  await Promise.all(c);
17
17
  }
18
18
  return await s(i), a;
19
19
  }
20
- export { findYamlFilesRecursive };
20
+ export { i as findYamlFilesRecursive };
@@ -1,4 +1,4 @@
1
- function isYamlFile(e) {
1
+ function e(e) {
2
2
  return e.endsWith(".yml") || e.endsWith(".yaml");
3
3
  }
4
- export { isYamlFile };
4
+ export { e as isYamlFile };
@@ -1,10 +1,10 @@
1
- import { readFile } from "node:fs/promises";
2
- import { parseDocument } from "yaml";
3
- async function readYamlDocument(n) {
4
- let r = await readFile(n, "utf8");
1
+ import { readFile as e } from "node:fs/promises";
2
+ import { parseDocument as t } from "yaml";
3
+ async function n(n) {
4
+ let r = await e(n, "utf8");
5
5
  return {
6
- document: parseDocument(r),
6
+ document: t(r),
7
7
  content: r
8
8
  };
9
9
  }
10
- export { readYamlDocument };
10
+ export { n as readYamlDocument };
@@ -1,7 +1,7 @@
1
- import { readFile } from "node:fs/promises";
2
- async function shouldIgnore(t, n) {
1
+ import { readFile as e } from "node:fs/promises";
2
+ async function t(t, n) {
3
3
  if (!t) return !1;
4
- let r = (await readFile(t, "utf8")).split("\n");
4
+ let r = (await e(t, "utf8")).split("\n");
5
5
  for (let e of r) if (e.includes("actions-up-ignore-file")) return !0;
6
6
  if (!n || n <= 0) return !1;
7
7
  let i = /* @__PURE__ */ new Set(), a = !1;
@@ -11,4 +11,4 @@ async function shouldIgnore(t, n) {
11
11
  }
12
12
  return i.has(n);
13
13
  }
14
- export { shouldIgnore };
14
+ export { t as shouldIgnore };
@@ -1,5 +1,5 @@
1
- import { applyUpdates } from "./ast/update/apply-updates.js";
2
- import { checkUpdates } from "./api/check-updates.js";
3
- import { scanRecursive } from "./scan-recursive.js";
4
- import { scanGitHubActions } from "./scan-github-actions.js";
5
- export { applyUpdates, checkUpdates, scanGitHubActions, scanRecursive };
1
+ import { applyUpdates as e } from "./ast/update/apply-updates.js";
2
+ import { checkUpdates as t } from "./api/check-updates.js";
3
+ import { scanRecursive as n } from "./scan-recursive.js";
4
+ import { scanGitHubActions as r } from "./scan-github-actions.js";
5
+ export { e as applyUpdates, t as checkUpdates, r as scanGitHubActions, n as scanRecursive };
@@ -1,22 +1,22 @@
1
- import pc from "picocolors";
2
- import semver from "semver";
3
- function formatVersion(i, a) {
4
- if (!i) return pc.gray("unknown");
5
- let o = semver.parse(i), s = a ? semver.parse(normalizeVersion(a)) : null;
6
- if (!s || !o) return i;
7
- let c = semver.diff(normalizeVersion(a), i), l = s.major === 0 ? pc.yellowBright : pc.gray, u = [
1
+ import e from "picocolors";
2
+ import t from "semver";
3
+ function n(n, a) {
4
+ if (!n) return e.gray("unknown");
5
+ let o = t.parse(n), s = a ? t.parse(r(a)) : null;
6
+ if (!s || !o) return n;
7
+ let c = t.diff(r(a), n), l = s.major === 0 ? e.yellowBright : e.gray, u = [
8
8
  o.major,
9
9
  o.minor,
10
10
  o.patch
11
- ], d = u.map((r, i) => c === "major" ? pc.redBright : c === "minor" && i >= 1 || c === "patch" && i === 2 ? l : identity), f = d[0](String(u[0]));
11
+ ], d = u.map((t, n) => c === "major" ? e.redBright : c === "minor" && n >= 1 || c === "patch" && n === 2 ? l : i), f = d[0](String(u[0]));
12
12
  return u[1] !== void 0 && (f += d[0](".") + d[1](String(u[1]))), u[2] !== void 0 && (f += d[1](".") + d[2](String(u[2]))), f;
13
13
  }
14
- function normalizeVersion(e) {
15
- let r = e.replace(/^v/u, "").split(".");
16
- for (; r.length < 3;) r.push("0");
17
- return r.slice(0, 3).join(".");
14
+ function r(e) {
15
+ let t = e.replace(/^v/u, "").split(".");
16
+ for (; t.length < 3;) t.push("0");
17
+ return t.slice(0, 3).join(".");
18
18
  }
19
- function identity(e) {
19
+ function i(e) {
20
20
  return e;
21
21
  }
22
- export { formatVersion };
22
+ export { n as formatVersion };
@@ -1,6 +1,6 @@
1
- import { stripAnsi } from "./strip-ansi.js";
2
- function padString(t, n) {
3
- let r = n - stripAnsi(t).length;
1
+ import { stripAnsi as e } from "./strip-ansi.js";
2
+ function t(t, n) {
3
+ let r = n - e(t).length;
4
4
  return r <= 0 ? t : t + " ".repeat(r);
5
5
  }
6
- export { padString };
6
+ export { t as padString };