actions-up 1.13.0 → 1.14.1
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/cli/build-json-report.d.ts +57 -36
- package/dist/cli/build-json-report.js +22 -18
- package/dist/cli/index.js +137 -122
- package/dist/cli/merge-scan-results.js +2 -2
- package/dist/cli/normalize-update-mode.js +2 -2
- package/dist/cli/normalize-update-style.d.ts +8 -0
- package/dist/cli/normalize-update-style.js +6 -0
- package/dist/cli/print-mode-warning.js +5 -5
- package/dist/cli/print-skipped-warning.d.ts +4 -1
- package/dist/cli/print-skipped-warning.js +10 -6
- package/dist/cli/resolve-scan-directories.js +8 -8
- package/dist/cli/validate-cli-options.js +2 -2
- package/dist/core/api/check-updates.d.ts +2 -0
- package/dist/core/api/check-updates.js +120 -96
- package/dist/core/api/create-github-client.js +26 -26
- package/dist/core/api/get-all-releases.js +12 -12
- package/dist/core/api/get-all-tags.js +4 -4
- package/dist/core/api/get-compatible-update.js +6 -6
- package/dist/core/api/get-latest-release.js +15 -15
- package/dist/core/api/get-reference-type.js +5 -5
- package/dist/core/api/get-tag-info.js +14 -14
- package/dist/core/api/get-tag-sha.js +7 -7
- package/dist/core/api/internal-rate-limit-error.js +2 -2
- package/dist/core/api/make-request.js +4 -4
- package/dist/core/api/resolve-github-token-sync.js +7 -7
- package/dist/core/api/update-rate-limit-info.js +3 -6
- package/dist/core/ast/guards/has-range.js +2 -2
- package/dist/core/ast/guards/is-node.js +2 -2
- package/dist/core/ast/guards/is-pair.js +2 -2
- package/dist/core/ast/guards/is-scalar.js +2 -2
- package/dist/core/ast/guards/is-yaml-map.js +2 -2
- package/dist/core/ast/guards/is-yaml-sequence.js +2 -2
- package/dist/core/ast/scanners/scan-composite-action-ast.js +13 -13
- package/dist/core/ast/scanners/scan-workflow-ast.js +21 -21
- package/dist/core/ast/update/apply-updates.d.ts +1 -1
- package/dist/core/ast/update/apply-updates.js +35 -22
- package/dist/core/ast/utils/extract-uses-from-steps.js +14 -14
- package/dist/core/ast/utils/find-map-pair.js +6 -6
- package/dist/core/ast/utils/get-line-number.js +4 -4
- package/dist/core/constants.js +2 -2
- package/dist/core/filters/parse-exclude-patterns.js +2 -2
- package/dist/core/fs/find-yaml-files-recursive.js +9 -9
- package/dist/core/fs/is-yaml-file.js +2 -2
- package/dist/core/fs/read-yaml-document.js +6 -6
- package/dist/core/ignore/should-ignore.js +4 -4
- package/dist/core/index.js +5 -5
- package/dist/core/interactive/format-version.js +14 -14
- package/dist/core/interactive/pad-string.js +4 -4
- package/dist/core/interactive/prompt-update-selection.js +162 -135
- package/dist/core/interactive/strip-ansi.js +2 -2
- package/dist/core/parsing/parse-action-reference.js +2 -2
- package/dist/core/scan-action-file.js +6 -6
- package/dist/core/scan-github-actions.js +83 -83
- package/dist/core/scan-recursive.js +24 -24
- package/dist/core/scan-workflow-file.js +6 -6
- package/dist/core/schema/composite/is-composite-action-runs.js +2 -2
- package/dist/core/schema/composite/is-composite-action-structure.js +2 -2
- package/dist/core/schema/workflow/is-workflow-structure.js +2 -2
- package/dist/core/updates/resolve-target-reference.d.ts +10 -0
- package/dist/core/updates/resolve-target-reference.js +24 -0
- package/dist/core/versions/find-compatible-tag.js +16 -16
- package/dist/core/versions/get-update-level.js +8 -8
- package/dist/core/versions/is-semver-like.js +2 -2
- package/dist/core/versions/is-sha.js +2 -2
- package/dist/core/versions/normalize-version.js +4 -4
- package/dist/core/versions/read-inline-version-comment.js +4 -4
- package/dist/package.js +2 -2
- package/dist/types/action-update.d.ts +16 -1
- package/dist/types/update-style.d.ts +4 -0
- package/package.json +2 -2
- package/readme.md +24 -5
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { makeRequest } from "./make-request.js";
|
|
2
|
-
async function
|
|
1
|
+
import { makeRequest as e } from "./make-request.js";
|
|
2
|
+
async function t(t, n) {
|
|
3
3
|
let { reference: r, owner: i, repo: a } = n, o = `${i}/${a}#${r}`;
|
|
4
4
|
if (t.caches.refType.has(o)) return t.caches.refType.get(o) ?? null;
|
|
5
5
|
try {
|
|
6
|
-
return await
|
|
6
|
+
return await e(t, `/repos/${i}/${a}/git/refs/tags/${r}`), t.caches.refType.set(o, "tag"), "tag";
|
|
7
7
|
} catch {
|
|
8
8
|
try {
|
|
9
|
-
return await
|
|
9
|
+
return await e(t, `/repos/${i}/${a}/git/refs/heads/${r}`), t.caches.refType.set(o, "branch"), "branch";
|
|
10
10
|
} catch {
|
|
11
11
|
return t.caches.refType.set(o, null), null;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
export { getReferenceType };
|
|
15
|
+
export { t as getReferenceType };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { makeRequest } from "./make-request.js";
|
|
2
|
-
import { GitHubRateLimitError } from "./internal-rate-limit-error.js";
|
|
3
|
-
async function
|
|
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, i) {
|
|
4
4
|
try {
|
|
5
5
|
let { owner: t, repo: a, tag: o } = i, s = o.replace(/^refs\/tags\//u, ""), c = `${t}/${a}#${s}`;
|
|
6
6
|
if (n.caches.tagInfo.has(c)) return n.caches.tagInfo.get(c) ?? null;
|
|
7
7
|
try {
|
|
8
|
-
let i = (await
|
|
8
|
+
let i = (await e(n, `/repos/${t}/${a}/releases/tags/${s}`)).data, o = i.published_at ? new Date(i.published_at) : null, l = i.body ?? null, u = null;
|
|
9
9
|
try {
|
|
10
|
-
let { type: r, sha: i } = (await
|
|
10
|
+
let { type: r, sha: i } = (await e(n, `/repos/${t}/${a}/git/refs/tags/${s}`)).data.object;
|
|
11
11
|
if (i && r === "tag") try {
|
|
12
|
-
let r = (await
|
|
12
|
+
let r = (await e(n, `/repos/${t}/${a}/git/tags/${i}`)).data;
|
|
13
13
|
u = r.object.sha ?? i;
|
|
14
14
|
let s = r.tagger?.date;
|
|
15
15
|
!o && s && (o = new Date(s)), !l && typeof r.message == "string" && ({message: l} = r);
|
|
@@ -17,13 +17,13 @@ async function getTagInfo(n, i) {
|
|
|
17
17
|
u = i;
|
|
18
18
|
}
|
|
19
19
|
else if (i && r === "commit" && (u = i, !o || !l)) try {
|
|
20
|
-
let { message: r, author: s } = (await
|
|
20
|
+
let { message: r, author: s } = (await e(n, `/repos/${t}/${a}/git/commits/${i}`)).data;
|
|
21
21
|
!l && typeof r == "string" && (l = r);
|
|
22
22
|
let c = s?.date;
|
|
23
23
|
!o && c && (o = new Date(c));
|
|
24
24
|
} catch {}
|
|
25
25
|
} catch {
|
|
26
|
-
|
|
26
|
+
r(i.target_commitish) && (u = i.target_commitish);
|
|
27
27
|
}
|
|
28
28
|
let d = {
|
|
29
29
|
tag: s,
|
|
@@ -34,13 +34,13 @@ async function getTagInfo(n, i) {
|
|
|
34
34
|
return n.caches.tagInfo.set(c, d), d;
|
|
35
35
|
} catch {
|
|
36
36
|
try {
|
|
37
|
-
let r = (await
|
|
37
|
+
let r = (await e(n, `/repos/${t}/${a}/git/refs/tags/${s}`)).data, { sha: i } = r.object, o = null, l = null;
|
|
38
38
|
if (r.object.type === "tag") try {
|
|
39
|
-
let r = (await
|
|
39
|
+
let r = (await e(n, `/repos/${t}/${a}/git/tags/${i}`)).data;
|
|
40
40
|
i = r.object.sha ?? i, o = r.message ?? null, l = r.tagger.date ? new Date(r.tagger.date) : null;
|
|
41
41
|
} catch {}
|
|
42
42
|
else try {
|
|
43
|
-
let r = (await
|
|
43
|
+
let r = (await e(n, `/repos/${t}/${a}/git/commits/${i}`)).data;
|
|
44
44
|
o = r.message ?? null, l = r.author.date ? new Date(r.author.date) : null;
|
|
45
45
|
} catch {}
|
|
46
46
|
let u = {
|
|
@@ -56,12 +56,12 @@ async function getTagInfo(n, i) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
} catch (e) {
|
|
59
|
-
throw e instanceof Error && e.message.includes("rate limit") ? new
|
|
59
|
+
throw e instanceof Error && e.message.includes("rate limit") ? new t(n.rateLimitReset) : e;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function r(e) {
|
|
63
63
|
if (typeof e != "string" || e.trim() === "") return !1;
|
|
64
64
|
let t = e.replace(/^v/u, "");
|
|
65
65
|
return /^[0-9a-f]{7,40}$/iu.test(t);
|
|
66
66
|
}
|
|
67
|
-
export { getTagInfo };
|
|
67
|
+
export { n as getTagInfo };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { makeRequest } from "./make-request.js";
|
|
2
|
-
import { GitHubRateLimitError } from "./internal-rate-limit-error.js";
|
|
3
|
-
async function
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 (
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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,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
|
|
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 (!
|
|
9
|
-
let l =
|
|
10
|
-
if (!l?.value || !
|
|
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 || !
|
|
13
|
-
let d =
|
|
14
|
-
return d?.value ?
|
|
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
|
|
11
|
-
if (!
|
|
12
|
-
let f =
|
|
13
|
-
if (!f?.value || !
|
|
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 (!
|
|
17
|
-
let l =
|
|
18
|
-
if (f?.value && f.key &&
|
|
19
|
-
let
|
|
20
|
-
|
|
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 =
|
|
23
|
-
m?.value && p.push(...
|
|
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,40 +1,53 @@
|
|
|
1
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
-
async function
|
|
3
|
-
let
|
|
1
|
+
import { readFile as e, writeFile as t } from "node:fs/promises";
|
|
2
|
+
async function n(n) {
|
|
3
|
+
let i = /* @__PURE__ */ new Map();
|
|
4
4
|
for (let e of n) {
|
|
5
5
|
let { file: t } = e.action;
|
|
6
6
|
if (!t) continue;
|
|
7
|
-
let n =
|
|
8
|
-
n.push(e),
|
|
7
|
+
let n = i.get(t) ?? [];
|
|
8
|
+
n.push(e), i.set(t, n);
|
|
9
9
|
}
|
|
10
|
-
let
|
|
11
|
-
let
|
|
12
|
-
for (let e of
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
let a = [...i.entries()].map(async ([n, i]) => {
|
|
11
|
+
let a = await e(n, "utf8");
|
|
12
|
+
for (let e of i) {
|
|
13
|
+
let t = e.targetRef ?? e.latestSha, n = e.targetRefStyle ?? (e.latestSha ? "sha" : null);
|
|
14
|
+
if (!t || !n) continue;
|
|
15
|
+
function i(e) {
|
|
15
16
|
return e.replaceAll(/[$()*+\-./?[\\\]^{|}]/gu, String.raw`\$&`);
|
|
16
17
|
}
|
|
17
|
-
let
|
|
18
|
-
if (
|
|
18
|
+
let o = i(e.action.name), s = e.currentVersion ? i(e.currentVersion) : "";
|
|
19
|
+
if (o.includes("\n") || o.includes("\r")) {
|
|
19
20
|
console.error(`Invalid action name: ${e.action.name}`);
|
|
20
21
|
continue;
|
|
21
22
|
}
|
|
22
|
-
if (
|
|
23
|
+
if (s && (s.includes("\n") || s.includes("\r"))) {
|
|
23
24
|
console.error(`Invalid version: ${e.currentVersion}`);
|
|
24
25
|
continue;
|
|
25
26
|
}
|
|
26
|
-
if (
|
|
27
|
-
console.error(`Invalid
|
|
27
|
+
if (t.includes("\n") || t.includes("\r") || t.trim() === "") {
|
|
28
|
+
console.error(`Invalid target ref: ${t}`);
|
|
28
29
|
continue;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
if (n === "sha" && !/^[\da-f]{40}$/iu.test(t)) {
|
|
32
|
+
console.error(`Invalid SHA format: ${t}`);
|
|
33
|
+
continue;
|
|
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) => {
|
|
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 (n === "sha") p = d && !l.comment && s !== "" ? "" : `${f}# ${e.latestVersion}`;
|
|
39
|
+
else if (l.comment && !r(l.comment)) {
|
|
40
|
+
let { comment: e } = l;
|
|
41
|
+
p = e;
|
|
42
|
+
}
|
|
43
|
+
return `${`${l.prefix}${l.quote}${l.name}`}@${`${t}${l.quote}${l.after}${p}`}`;
|
|
34
44
|
});
|
|
35
45
|
}
|
|
36
|
-
await
|
|
46
|
+
await t(n, a, "utf8");
|
|
37
47
|
});
|
|
38
|
-
await Promise.all(
|
|
48
|
+
await Promise.all(a);
|
|
49
|
+
}
|
|
50
|
+
function r(e) {
|
|
51
|
+
return /^#\s*[Vv]?\d+(?:\.\d+){0,2}(?:[+-][\w\-.]+)?\s*$/u.test(e.trim());
|
|
39
52
|
}
|
|
40
|
-
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
|
|
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 (!
|
|
10
|
+
if (!t(c)) return [];
|
|
11
11
|
let f = [];
|
|
12
|
-
for (let
|
|
13
|
-
if (!
|
|
14
|
-
let s =
|
|
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 =
|
|
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
|
|
5
|
-
return !
|
|
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
|
|
3
|
-
if (
|
|
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 };
|
package/dist/core/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
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
|
|
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
|
|
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
|
|
7
|
+
if ((await n(i)).isSymbolicLink() || o.has(i)) return;
|
|
8
8
|
o.add(i);
|
|
9
|
-
let c = (await
|
|
9
|
+
let c = (await r(i)).map(async (r) => {
|
|
10
10
|
try {
|
|
11
|
-
let 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() &&
|
|
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,10 +1,10 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { parseDocument } from "yaml";
|
|
3
|
-
async function
|
|
4
|
-
let r = await
|
|
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:
|
|
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
|
|
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
|
|
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 };
|
package/dist/core/index.js
CHANGED
|
@@ -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 };
|