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,156 +1,156 @@
|
|
|
1
|
-
import { ACTIONS_DIRECTORY, GITHUB_DIRECTORY, WORKFLOWS_DIRECTORY } from "./constants.js";
|
|
2
|
-
import { isYamlFile } from "./fs/is-yaml-file.js";
|
|
3
|
-
import { scanWorkflowFile } from "./scan-workflow-file.js";
|
|
4
|
-
import { scanActionFile } from "./scan-action-file.js";
|
|
5
|
-
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
6
|
-
import { readFile, readdir, stat } from "node:fs/promises";
|
|
7
|
-
async function
|
|
1
|
+
import { ACTIONS_DIRECTORY as e, GITHUB_DIRECTORY as t, WORKFLOWS_DIRECTORY as n } from "./constants.js";
|
|
2
|
+
import { isYamlFile as r } from "./fs/is-yaml-file.js";
|
|
3
|
+
import { scanWorkflowFile as i } from "./scan-workflow-file.js";
|
|
4
|
+
import { scanActionFile as a } from "./scan-action-file.js";
|
|
5
|
+
import { isAbsolute as o, join as s, relative as c, resolve as l } from "node:path";
|
|
6
|
+
import { readFile as u, readdir as d, stat as f } from "node:fs/promises";
|
|
7
|
+
async function p(u = process.cwd(), p = t) {
|
|
8
8
|
let h = {
|
|
9
9
|
compositeActions: /* @__PURE__ */ new Map(),
|
|
10
10
|
workflows: /* @__PURE__ */ new Map(),
|
|
11
11
|
actions: []
|
|
12
|
-
}, g =
|
|
13
|
-
function _(e,
|
|
14
|
-
let
|
|
15
|
-
return
|
|
12
|
+
}, g = l(u);
|
|
13
|
+
function _(e, t) {
|
|
14
|
+
let n = c(e, t);
|
|
15
|
+
return n !== "" && !n.startsWith("..") && !o(n);
|
|
16
16
|
}
|
|
17
|
-
let v =
|
|
17
|
+
let v = s(g, p);
|
|
18
18
|
function y(e) {
|
|
19
19
|
return e.includes("..") || e.includes("/") || e.includes("\\") ? (console.warn(`Skipping invalid name: ${e}`), !1) : !0;
|
|
20
20
|
}
|
|
21
21
|
async function b(e) {
|
|
22
22
|
try {
|
|
23
|
-
let
|
|
24
|
-
return typeof
|
|
23
|
+
let t = await f(e);
|
|
24
|
+
return typeof t.isFile == "function" ? t.isFile() : !1;
|
|
25
25
|
} catch {
|
|
26
26
|
return !1;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
let x =
|
|
29
|
+
let x = s(v, n);
|
|
30
30
|
try {
|
|
31
|
-
if ((await
|
|
32
|
-
let e = (await
|
|
33
|
-
let
|
|
31
|
+
if ((await f(x)).isDirectory()) {
|
|
32
|
+
let e = (await d(x)).filter((e) => y(e) ? r(e) : !1).map(async (e) => {
|
|
33
|
+
let t = s(x, e);
|
|
34
34
|
try {
|
|
35
|
-
let
|
|
35
|
+
let r = await i(t);
|
|
36
36
|
return {
|
|
37
|
-
path: `${
|
|
37
|
+
path: `${p}/${n}/${e}`,
|
|
38
38
|
success: !0,
|
|
39
|
-
actions:
|
|
39
|
+
actions: r
|
|
40
40
|
};
|
|
41
41
|
} catch {
|
|
42
42
|
return {
|
|
43
|
-
path: `${
|
|
43
|
+
path: `${p}/${n}/${e}`,
|
|
44
44
|
success: !1,
|
|
45
45
|
actions: []
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
}),
|
|
49
|
-
for (let e of
|
|
48
|
+
}), t = await Promise.all(e);
|
|
49
|
+
for (let e of t) e.success && e.path && (e.actions.length > 0 ? (h.workflows.set(e.path, e.actions), h.actions.push(...e.actions)) : h.workflows.set(e.path, []));
|
|
50
50
|
}
|
|
51
51
|
} catch {}
|
|
52
52
|
try {
|
|
53
|
-
let e =
|
|
53
|
+
let e = s(g, "action.yml"), t = s(g, "action.yaml"), n = null, r = [];
|
|
54
54
|
if (await b(e)) try {
|
|
55
|
-
|
|
55
|
+
r = await a(e), n = e;
|
|
56
56
|
} catch {
|
|
57
|
-
|
|
57
|
+
n = null;
|
|
58
58
|
}
|
|
59
|
-
if (!
|
|
60
|
-
|
|
59
|
+
if (!n && await b(t)) try {
|
|
60
|
+
r = await a(t), n = t;
|
|
61
61
|
} catch {
|
|
62
|
-
|
|
62
|
+
n = null;
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
65
|
-
let e =
|
|
66
|
-
h.compositeActions.set(e, e),
|
|
64
|
+
if (n) {
|
|
65
|
+
let e = c(g, n);
|
|
66
|
+
h.compositeActions.set(e, e), r.length > 0 && h.actions.push(...r);
|
|
67
67
|
}
|
|
68
68
|
} catch {}
|
|
69
|
-
let S =
|
|
69
|
+
let S = s(v, e);
|
|
70
70
|
try {
|
|
71
|
-
if ((await
|
|
72
|
-
let
|
|
73
|
-
if (!y(
|
|
74
|
-
let
|
|
71
|
+
if ((await f(S)).isDirectory()) {
|
|
72
|
+
let t = (await d(S)).map(async (t) => {
|
|
73
|
+
if (!y(t)) return null;
|
|
74
|
+
let n = s(S, t);
|
|
75
75
|
try {
|
|
76
|
-
if (!(await
|
|
77
|
-
let
|
|
76
|
+
if (!(await f(n)).isDirectory()) return null;
|
|
77
|
+
let r = s(n, "action.yml"), i = [];
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
i = await a(r);
|
|
80
80
|
} catch {
|
|
81
81
|
try {
|
|
82
|
-
|
|
82
|
+
r = s(n, "action.yaml"), i = await a(r);
|
|
83
83
|
} catch {
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
return {
|
|
88
|
-
path: `${
|
|
89
|
-
name:
|
|
90
|
-
actions:
|
|
88
|
+
path: `${p}/${e}/${t}`,
|
|
89
|
+
name: t,
|
|
90
|
+
actions: i
|
|
91
91
|
};
|
|
92
92
|
} catch {
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
95
|
-
}),
|
|
96
|
-
for (let e of
|
|
95
|
+
}), n = await Promise.all(t);
|
|
96
|
+
for (let e of n) e && (h.compositeActions.set(e.name, e.path), h.actions.push(...e.actions));
|
|
97
97
|
}
|
|
98
98
|
} catch {}
|
|
99
99
|
try {
|
|
100
|
-
let e = await
|
|
100
|
+
let e = await m(g);
|
|
101
101
|
if (e) {
|
|
102
102
|
if (process.env.ACTIONS_UP_TEST_THROW === "1") throw Error("test");
|
|
103
|
-
let
|
|
104
|
-
for (let
|
|
105
|
-
if (
|
|
106
|
-
let
|
|
107
|
-
if (
|
|
108
|
-
let
|
|
109
|
-
_(g,
|
|
103
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
104
|
+
for (let r of h.actions) {
|
|
105
|
+
if (r.type !== "external") continue;
|
|
106
|
+
let i = r.name.split("/");
|
|
107
|
+
if (i.length < 3 || `${i[0]}/${i[1]}` !== e) continue;
|
|
108
|
+
let a = s(g, ...i.slice(2));
|
|
109
|
+
_(g, a) && (t.has(a) || (t.add(a), n.push(a)));
|
|
110
110
|
}
|
|
111
|
-
async function
|
|
112
|
-
if (
|
|
113
|
-
let
|
|
111
|
+
async function r() {
|
|
112
|
+
if (n.length === 0) return;
|
|
113
|
+
let i = n.splice(0), o = await Promise.all(i.map(async (n) => {
|
|
114
114
|
try {
|
|
115
|
-
let
|
|
115
|
+
let r = s(n, "action.yml"), i = s(n, "action.yaml"), o = r;
|
|
116
116
|
try {
|
|
117
|
-
if (!(await
|
|
117
|
+
if (!(await f(r)).isFile()) throw Error("not a file");
|
|
118
118
|
} catch {
|
|
119
|
-
if (!(await
|
|
120
|
-
|
|
119
|
+
if (!(await f(i)).isFile()) throw Error("not a file");
|
|
120
|
+
o = i;
|
|
121
121
|
}
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
let
|
|
125
|
-
for (let
|
|
126
|
-
if (
|
|
127
|
-
let
|
|
128
|
-
if (
|
|
129
|
-
let
|
|
130
|
-
_(g,
|
|
122
|
+
let c = await a(o);
|
|
123
|
+
c.length > 0 && h.actions.push(...c);
|
|
124
|
+
let l = [];
|
|
125
|
+
for (let n of c) {
|
|
126
|
+
if (n.type !== "external") continue;
|
|
127
|
+
let r = n.name.split("/");
|
|
128
|
+
if (r.length < 3 || `${r[0]}/${r[1]}` !== e) continue;
|
|
129
|
+
let i = s(g, ...r.slice(2));
|
|
130
|
+
_(g, i) && (t.has(i) || (t.add(i), l.push(i)));
|
|
131
131
|
}
|
|
132
|
-
return
|
|
132
|
+
return l;
|
|
133
133
|
} catch {
|
|
134
134
|
return [];
|
|
135
135
|
}
|
|
136
136
|
}));
|
|
137
|
-
for (let e of
|
|
138
|
-
await
|
|
137
|
+
for (let e of o) for (let t of e) n.push(t);
|
|
138
|
+
await r();
|
|
139
139
|
}
|
|
140
|
-
await
|
|
140
|
+
await r();
|
|
141
141
|
}
|
|
142
142
|
} catch {}
|
|
143
143
|
return h;
|
|
144
144
|
}
|
|
145
|
-
async function
|
|
146
|
-
let
|
|
147
|
-
if (
|
|
145
|
+
async function m(e) {
|
|
146
|
+
let t = process.env.GITHUB_REPOSITORY;
|
|
147
|
+
if (t && /^[^\s/]+\/[^\s/]+$/u.test(t)) return t;
|
|
148
148
|
try {
|
|
149
|
-
let
|
|
150
|
-
if (
|
|
151
|
-
let
|
|
152
|
-
if (
|
|
149
|
+
let t = await u(s(e, ".git", "config"), "utf8"), n = t.match(/\[remote "origin"\][\s\S]*?url\s*=\s*(?<url>.+)/u)?.groups?.url?.trim();
|
|
150
|
+
if (n ||= t.match(/url\s*=\s*(?<url>.+)/u)?.groups?.url?.trim(), !n) return null;
|
|
151
|
+
let r = n.match(/github\.com[/:](?<owner>[^/]+)\/(?<repo>[^./]+)(?:\.git)?$/u);
|
|
152
|
+
if (r?.groups) return `${r.groups.owner}/${r.groups.repo}`;
|
|
153
153
|
} catch {}
|
|
154
154
|
return null;
|
|
155
155
|
}
|
|
156
|
-
export { scanGitHubActions };
|
|
156
|
+
export { p as scanGitHubActions };
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { isCompositeActionStructure } from "./schema/composite/is-composite-action-structure.js";
|
|
2
|
-
import { scanCompositeActionAst } from "./ast/scanners/scan-composite-action-ast.js";
|
|
3
|
-
import { isWorkflowStructure } from "./schema/workflow/is-workflow-structure.js";
|
|
4
|
-
import { findYamlFilesRecursive } from "./fs/find-yaml-files-recursive.js";
|
|
5
|
-
import { scanWorkflowAst } from "./ast/scanners/scan-workflow-ast.js";
|
|
6
|
-
import { readYamlDocument } from "./fs/read-yaml-document.js";
|
|
7
|
-
import { dirname, relative, resolve } from "node:path";
|
|
8
|
-
async function
|
|
1
|
+
import { isCompositeActionStructure as e } from "./schema/composite/is-composite-action-structure.js";
|
|
2
|
+
import { scanCompositeActionAst as t } from "./ast/scanners/scan-composite-action-ast.js";
|
|
3
|
+
import { isWorkflowStructure as n } from "./schema/workflow/is-workflow-structure.js";
|
|
4
|
+
import { findYamlFilesRecursive as r } from "./fs/find-yaml-files-recursive.js";
|
|
5
|
+
import { scanWorkflowAst as i } from "./ast/scanners/scan-workflow-ast.js";
|
|
6
|
+
import { readYamlDocument as a } from "./fs/read-yaml-document.js";
|
|
7
|
+
import { dirname as o, relative as s, resolve as c } from "node:path";
|
|
8
|
+
async function l(l, d) {
|
|
9
9
|
let f = {
|
|
10
10
|
compositeActions: /* @__PURE__ */ new Map(),
|
|
11
11
|
workflows: /* @__PURE__ */ new Map(),
|
|
12
12
|
actions: []
|
|
13
|
-
}, p =
|
|
13
|
+
}, p = c(l), m = c(p, d), h;
|
|
14
14
|
try {
|
|
15
|
-
h = await
|
|
15
|
+
h = await r(m);
|
|
16
16
|
} catch {
|
|
17
17
|
return f;
|
|
18
18
|
}
|
|
19
|
-
let g = h.map(async (
|
|
20
|
-
let
|
|
19
|
+
let g = h.map(async (r) => {
|
|
20
|
+
let o = s(p, r);
|
|
21
21
|
try {
|
|
22
|
-
let { document:
|
|
23
|
-
if (
|
|
22
|
+
let { document: s, content: c } = await a(r), l = s.toJSON();
|
|
23
|
+
if (n(l) && u(l, "jobs")) return {
|
|
24
24
|
type: "workflow",
|
|
25
|
-
path:
|
|
26
|
-
actions:
|
|
25
|
+
path: o,
|
|
26
|
+
actions: i(s, c, r)
|
|
27
27
|
};
|
|
28
|
-
if (
|
|
28
|
+
if (e(l) && u(l, "runs")) return {
|
|
29
29
|
type: "action",
|
|
30
|
-
path:
|
|
31
|
-
actions:
|
|
30
|
+
path: o,
|
|
31
|
+
actions: t(s, c, r)
|
|
32
32
|
};
|
|
33
33
|
} catch {}
|
|
34
34
|
return null;
|
|
35
35
|
}), _ = await Promise.all(g);
|
|
36
36
|
for (let e of _) if (e) if (e.type === "workflow") f.workflows.set(e.path, e.actions), f.actions.push(...e.actions);
|
|
37
37
|
else {
|
|
38
|
-
let
|
|
39
|
-
f.compositeActions.set(
|
|
38
|
+
let t = o(e.path), n = t === "." || t === "" ? e.path : t;
|
|
39
|
+
f.compositeActions.set(n, e.path), f.actions.push(...e.actions);
|
|
40
40
|
}
|
|
41
41
|
return f;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return typeof e == "object" && !!e &&
|
|
43
|
+
function u(e, t) {
|
|
44
|
+
return typeof e == "object" && !!e && t in e;
|
|
45
45
|
}
|
|
46
|
-
export { scanRecursive };
|
|
46
|
+
export { l as scanRecursive };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { scanWorkflowAst } from "./ast/scanners/scan-workflow-ast.js";
|
|
2
|
-
import { readYamlDocument } from "./fs/read-yaml-document.js";
|
|
3
|
-
async function
|
|
4
|
-
let { document: r, content: i } = await
|
|
5
|
-
return
|
|
1
|
+
import { scanWorkflowAst as e } from "./ast/scanners/scan-workflow-ast.js";
|
|
2
|
+
import { readYamlDocument as t } from "./fs/read-yaml-document.js";
|
|
3
|
+
async function n(n) {
|
|
4
|
+
let { document: r, content: i } = await t(n);
|
|
5
|
+
return e(r, i, n);
|
|
6
6
|
}
|
|
7
|
-
export { scanWorkflowFile };
|
|
7
|
+
export { n as scanWorkflowFile };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(e) {
|
|
2
2
|
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
3
3
|
let t = e;
|
|
4
4
|
return "name" in t || "description" in t || "runs" in t;
|
|
5
5
|
}
|
|
6
|
-
export { isCompositeActionStructure };
|
|
6
|
+
export { e as isCompositeActionStructure };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionUpdate } from '../../types/action-update';
|
|
2
|
+
import { UpdateStyle } from '../../types/update-style';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the final reference that should be written back to the workflow.
|
|
5
|
+
*
|
|
6
|
+
* @param update - Update entry enriched with lookup data.
|
|
7
|
+
* @param style - Effective update style.
|
|
8
|
+
* @returns Update entry with resolved target reference fields.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveTargetReference(update: ActionUpdate, style: UpdateStyle): ActionUpdate;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function e(e, t) {
|
|
2
|
+
return e.hasUpdate ? t === "sha" || e.currentRefType === "sha" ? e.latestSha ? {
|
|
3
|
+
...e,
|
|
4
|
+
targetRef: e.latestSha,
|
|
5
|
+
targetRefStyle: "sha"
|
|
6
|
+
} : {
|
|
7
|
+
...e,
|
|
8
|
+
targetRefStyle: null,
|
|
9
|
+
targetRef: null
|
|
10
|
+
} : e.currentRefType === "tag" && e.latestVersion ? {
|
|
11
|
+
...e,
|
|
12
|
+
targetRef: e.latestVersion,
|
|
13
|
+
targetRefStyle: "tag"
|
|
14
|
+
} : {
|
|
15
|
+
...e,
|
|
16
|
+
targetRefStyle: null,
|
|
17
|
+
targetRef: null
|
|
18
|
+
} : {
|
|
19
|
+
...e,
|
|
20
|
+
targetRefStyle: null,
|
|
21
|
+
targetRef: null
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export { e as resolveTargetReference };
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { normalizeVersion } from "./normalize-version.js";
|
|
2
|
-
import { isSemverLike } from "./is-semver-like.js";
|
|
3
|
-
import
|
|
4
|
-
function
|
|
5
|
-
if (!a || !
|
|
6
|
-
let s =
|
|
1
|
+
import { normalizeVersion as e } from "./normalize-version.js";
|
|
2
|
+
import { isSemverLike as t } from "./is-semver-like.js";
|
|
3
|
+
import n from "semver";
|
|
4
|
+
function r(r, a, o) {
|
|
5
|
+
if (!a || !t(a) || r.length === 0) return null;
|
|
6
|
+
let s = n.valid(e(a));
|
|
7
7
|
if (!s) return null;
|
|
8
|
-
let c =
|
|
8
|
+
let c = n.major(s), l = n.minor(s), u = [];
|
|
9
9
|
for (let i of r) {
|
|
10
|
-
if (!
|
|
11
|
-
let r =
|
|
12
|
-
r &&
|
|
10
|
+
if (!t(i.tag)) continue;
|
|
11
|
+
let r = n.valid(e(i.tag));
|
|
12
|
+
r && n.gt(r, s) && n.major(r) === c && (o === "patch" && n.minor(r) !== l || u.push({
|
|
13
13
|
tag: i,
|
|
14
14
|
parsed: r
|
|
15
15
|
}));
|
|
16
16
|
}
|
|
17
|
-
return u.length === 0 ? null : (u.sort((e,
|
|
18
|
-
let r =
|
|
17
|
+
return u.length === 0 ? null : (u.sort((e, t) => {
|
|
18
|
+
let r = n.rcompare(e.parsed, t.parsed);
|
|
19
19
|
if (r !== 0) return r;
|
|
20
|
-
let a =
|
|
21
|
-
return
|
|
20
|
+
let a = i(e.tag.tag);
|
|
21
|
+
return i(t.tag.tag) - a;
|
|
22
22
|
}), u[0].tag);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function i(e) {
|
|
25
25
|
return e.replace(/^v/u, "").split(".").length;
|
|
26
26
|
}
|
|
27
|
-
export { findCompatibleTag };
|
|
27
|
+
export { r as findCompatibleTag };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
1
|
+
import e from "semver";
|
|
2
|
+
function t(t, r) {
|
|
3
3
|
if (!t || !r) return "unknown";
|
|
4
|
-
let i =
|
|
4
|
+
let i = n(t), a = n(r);
|
|
5
5
|
if (!i || !a) return "unknown";
|
|
6
|
-
if (
|
|
7
|
-
let o =
|
|
6
|
+
if (e.eq(i, a)) return "none";
|
|
7
|
+
let o = e.diff(i, a);
|
|
8
8
|
if (!o) return "none";
|
|
9
9
|
switch (o) {
|
|
10
10
|
case "premajor":
|
|
@@ -16,8 +16,8 @@ function getUpdateLevel(t, r) {
|
|
|
16
16
|
default: return "unknown";
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
let n =
|
|
19
|
+
function n(t) {
|
|
20
|
+
let n = e.coerce(t);
|
|
21
21
|
return n ? n.version : null;
|
|
22
22
|
}
|
|
23
|
-
export { getUpdateLevel };
|
|
23
|
+
export { t as getUpdateLevel };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
1
|
+
import e from "semver";
|
|
2
|
+
function t(t) {
|
|
3
3
|
if (!t) return null;
|
|
4
4
|
let n = t.replace(/^v/u, "");
|
|
5
5
|
if (/^[0-9a-f]{7,40}$/iu.test(n)) return t;
|
|
6
|
-
let r =
|
|
6
|
+
let r = e.coerce(n);
|
|
7
7
|
return r ? r.version : t;
|
|
8
8
|
}
|
|
9
|
-
export { normalizeVersion };
|
|
9
|
+
export { t as normalizeVersion };
|
|
@@ -1,9 +1,9 @@
|
|
|
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, r) {
|
|
3
3
|
try {
|
|
4
4
|
if (!t || !n || n <= 0) return null;
|
|
5
5
|
let i = r?.get(t);
|
|
6
|
-
i === void 0 && (i = await
|
|
6
|
+
i === void 0 && (i = await e(t, "utf8"), r && r.set(t, i));
|
|
7
7
|
let a = i.split("\n"), o = n - 1;
|
|
8
8
|
if (o < 0 || o >= a.length) return null;
|
|
9
9
|
let s = a[o].match(/#\s*(?<version>[Vv]?\d+(?:\.\d+){0,2}(?:[+-][\w\-.]+)?)/u);
|
|
@@ -11,4 +11,4 @@ async function readInlineVersionComment(t, n, r) {
|
|
|
11
11
|
} catch {}
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
|
-
export { readInlineVersionComment };
|
|
14
|
+
export { t as readInlineVersionComment };
|
package/dist/package.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export { version };
|
|
1
|
+
var e = "1.14.1";
|
|
2
|
+
export { e as version };
|
|
@@ -6,7 +6,17 @@ export interface ActionUpdate {
|
|
|
6
6
|
/**
|
|
7
7
|
* Reason for skipping the update check.
|
|
8
8
|
*/
|
|
9
|
-
skipReason?: 'unknown' | 'branch'
|
|
9
|
+
skipReason?: 'unsupported-style' | 'unknown' | 'branch'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Detected style of the current reference in the source file.
|
|
13
|
+
*/
|
|
14
|
+
currentRefType?: 'unknown' | 'branch' | 'sha' | 'tag'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Style of the final reference that should be written back to the file.
|
|
18
|
+
*/
|
|
19
|
+
targetRefStyle?: 'sha' | 'tag' | null
|
|
10
20
|
|
|
11
21
|
/**
|
|
12
22
|
* Current version string.
|
|
@@ -23,6 +33,11 @@ export interface ActionUpdate {
|
|
|
23
33
|
*/
|
|
24
34
|
status?: 'skipped' | 'ok'
|
|
25
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Final reference that should be written back to the file.
|
|
38
|
+
*/
|
|
39
|
+
targetRef?: string | null
|
|
40
|
+
|
|
26
41
|
/**
|
|
27
42
|
* SHA hash of the latest version.
|
|
28
43
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "actions-up",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Interactive CLI tool to update GitHub Actions
|
|
3
|
+
"version": "1.14.1",
|
|
4
|
+
"description": "Interactive CLI tool to update GitHub Actions with SHA pinning or preserved refs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github-actions",
|
|
7
7
|
"actions",
|
package/readme.md
CHANGED
|
@@ -16,7 +16,7 @@ Actions Up scans your workflows and composite actions to discover every
|
|
|
16
16
|
referenced GitHub Action, then checks for newer releases.
|
|
17
17
|
|
|
18
18
|
Interactively upgrade and pin actions to exact commit SHAs for secure,
|
|
19
|
-
reproducible CI
|
|
19
|
+
reproducible CI, or preserve tag-style references when you need to stay on tags.
|
|
20
20
|
|
|
21
21
|
## Features
|
|
22
22
|
|
|
@@ -25,8 +25,8 @@ reproducible CI and low-friction maintenance.
|
|
|
25
25
|
`action.yml`/`action.yaml`)
|
|
26
26
|
- **Reusable Workflows**: Detects and updates reusable workflow calls at the job
|
|
27
27
|
level
|
|
28
|
-
- **
|
|
29
|
-
|
|
28
|
+
- **Flexible update styles**: Use SHA pinning by default, or preserve tag-style
|
|
29
|
+
references with `--style preserve`
|
|
30
30
|
- **Batch Updates**: Update multiple actions at once
|
|
31
31
|
- **Interactive Selection**: Choose which actions to update
|
|
32
32
|
- **Breaking Changes Detection**: Warns about major version updates
|
|
@@ -124,7 +124,7 @@ This will:
|
|
|
124
124
|
plus root `action.yml`/`action.yaml`
|
|
125
125
|
2. Check for available updates
|
|
126
126
|
3. Show an interactive list to select updates
|
|
127
|
-
4. Apply selected updates with SHA pinning
|
|
127
|
+
4. Apply selected updates with SHA pinning by default
|
|
128
128
|
|
|
129
129
|
### Auto-Update Mode
|
|
130
130
|
|
|
@@ -200,6 +200,24 @@ In `minor` and `patch` modes, Actions Up tries to find the newest compatible tag
|
|
|
200
200
|
first (for example, from `@v4` in `minor` mode it will choose the latest
|
|
201
201
|
`v4.x.y`). If no compatible version exists, that action is skipped.
|
|
202
202
|
|
|
203
|
+
### Update Style
|
|
204
|
+
|
|
205
|
+
By default, Actions Up writes updates as pinned SHAs:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
npx actions-up --style sha
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Use `--style preserve` to keep the current reference style:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
npx actions-up --style preserve
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
`preserve` keeps tag references on tags and SHA references on SHAs. For example,
|
|
218
|
+
`actions/checkout@v5` updates to `actions/checkout@v6.0.2`, while a SHA-pinned
|
|
219
|
+
action continues updating to the latest resolved SHA.
|
|
220
|
+
|
|
203
221
|
## GitHub Actions Integration
|
|
204
222
|
|
|
205
223
|
### Automated PR Checks
|
|
@@ -500,7 +518,8 @@ Ignore comments (file/block/next-line/inline):
|
|
|
500
518
|
Interactive CLI for developers who want control over GitHub Actions updates.
|
|
501
519
|
|
|
502
520
|
- **vs. Dependabot/Renovate:** Dependabot and Renovate update via pull requests;
|
|
503
|
-
Actions Up is an interactive CLI with explicit SHA pinning
|
|
521
|
+
Actions Up is an interactive CLI with explicit SHA pinning by default and an
|
|
522
|
+
opt-in preserve mode for tag users.
|
|
504
523
|
- **vs. pinact:** pinact is a CLI to pin and update Actions and reusable
|
|
505
524
|
workflows; Actions Up adds interactive selection and major update warnings.
|
|
506
525
|
- **Zero-config:** `npx actions-up` runs immediately.
|