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,8 +1,10 @@
|
|
|
1
|
+
import { UpdateStyle } from '../types/update-style';
|
|
1
2
|
/**
|
|
2
3
|
* Prints a warning message for actions that were skipped during scanning.
|
|
3
4
|
*
|
|
4
5
|
* @param skipped - Array of skipped actions with their current versions.
|
|
5
6
|
* @param includeBranches - Whether branch-pinned actions are being checked.
|
|
7
|
+
* @param style - Effective update style for the current run.
|
|
6
8
|
*/
|
|
7
9
|
export declare function printSkippedWarning(skipped: {
|
|
8
10
|
action: {
|
|
@@ -10,5 +12,6 @@ export declare function printSkippedWarning(skipped: {
|
|
|
10
12
|
uses?: string;
|
|
11
13
|
name: string;
|
|
12
14
|
};
|
|
15
|
+
skipReason?: 'unsupported-style' | 'unknown' | 'branch';
|
|
13
16
|
currentVersion: string | null;
|
|
14
|
-
}[], includeBranches: boolean): void;
|
|
17
|
+
}[], includeBranches: boolean, style: UpdateStyle): void;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
3
|
-
let
|
|
4
|
-
|
|
1
|
+
import e from "picocolors";
|
|
2
|
+
function t(e, t, r) {
|
|
3
|
+
let i = e.filter((e) => e.skipReason === "branch" || e.skipReason === void 0), a = e.filter((e) => e.skipReason === "unsupported-style");
|
|
4
|
+
i.length > 0 && n(i, t ? "pinned to branches" : "pinned to branches (use --include-branches to check them)"), a.length > 0 && n(a, r === "preserve" ? "whose current ref style could not be preserved" : "that could not be updated with the current style");
|
|
5
|
+
}
|
|
6
|
+
function n(t, n) {
|
|
7
|
+
let r = new Intl.PluralRules("en-US", { type: "cardinal" }).select(t.length) === "one" ? "action" : "actions";
|
|
8
|
+
console.info(e.yellow(`\n⚠️ Skipped ${t.length} ${r} ${n}`));
|
|
5
9
|
for (let n of t) {
|
|
6
10
|
let t = n.action.uses ?? `${n.action.name}@${n.currentVersion ?? "unknown"}`;
|
|
7
|
-
console.info(
|
|
11
|
+
console.info(e.gray(` • ${t}`));
|
|
8
12
|
}
|
|
9
13
|
}
|
|
10
|
-
export { printSkippedWarning };
|
|
14
|
+
export { t as printSkippedWarning };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { GITHUB_DIRECTORY } from "../core/constants.js";
|
|
2
|
-
import { basename, dirname, isAbsolute, relative, resolve } from "node:path";
|
|
3
|
-
function
|
|
1
|
+
import { GITHUB_DIRECTORY as e } from "../core/constants.js";
|
|
2
|
+
import { basename as t, dirname as n, isAbsolute as r, relative as i, resolve as a } from "node:path";
|
|
3
|
+
function o(o) {
|
|
4
4
|
let { recursive: s, cwd: c, dir: l } = o, u = [];
|
|
5
|
-
Array.isArray(l) ? u.push(...l) : typeof l == "string" ? u.push(l) : s ? u.push(".") : u.push(
|
|
5
|
+
Array.isArray(l) ? u.push(...l) : typeof l == "string" ? u.push(l) : s ? u.push(".") : u.push(e);
|
|
6
6
|
let d = /* @__PURE__ */ new Set(), f = [];
|
|
7
7
|
for (let e of u) {
|
|
8
|
-
let o =
|
|
8
|
+
let o = a(c, e), l = i(c, o), u = l.startsWith("..") || r(l) || a(c, l) !== o, p;
|
|
9
9
|
p = s ? {
|
|
10
10
|
root: o,
|
|
11
11
|
dir: "."
|
|
12
12
|
} : u ? {
|
|
13
|
-
dir:
|
|
14
|
-
root:
|
|
13
|
+
dir: t(o),
|
|
14
|
+
root: n(o)
|
|
15
15
|
} : {
|
|
16
16
|
dir: l || ".github",
|
|
17
17
|
root: c
|
|
@@ -21,4 +21,4 @@ function resolveScanDirectories(o) {
|
|
|
21
21
|
}
|
|
22
22
|
return f;
|
|
23
23
|
}
|
|
24
|
-
export { resolveScanDirectories };
|
|
24
|
+
export { o as resolveScanDirectories };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GitHubClient } from '../../types/github-client';
|
|
2
2
|
import { GitHubAction } from '../../types/github-action';
|
|
3
3
|
import { ActionUpdate } from '../../types/action-update';
|
|
4
|
+
import { UpdateStyle } from '../../types/update-style';
|
|
4
5
|
/**
|
|
5
6
|
* Check for updates for GitHub Actions.
|
|
6
7
|
*
|
|
@@ -13,4 +14,5 @@ import { ActionUpdate } from '../../types/action-update';
|
|
|
13
14
|
export declare function checkUpdates(actions: GitHubAction[], token?: string, options?: {
|
|
14
15
|
includeBranches?: boolean;
|
|
15
16
|
client?: GitHubClient;
|
|
17
|
+
style?: UpdateStyle;
|
|
16
18
|
}): Promise<ActionUpdate[]>;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { normalizeVersion } from "../versions/normalize-version.js";
|
|
2
|
-
import { isSemverLike } from "../versions/is-semver-like.js";
|
|
3
|
-
import { createGitHubClient } from "./create-github-client.js";
|
|
4
|
-
import
|
|
5
|
-
async function
|
|
6
|
-
let
|
|
7
|
-
if (
|
|
8
|
-
let
|
|
9
|
-
for (let e of
|
|
10
|
-
let t =
|
|
11
|
-
t.push(e),
|
|
1
|
+
import { normalizeVersion as e } from "../versions/normalize-version.js";
|
|
2
|
+
import { isSemverLike as t } from "../versions/is-semver-like.js";
|
|
3
|
+
import { createGitHubClient as n } from "./create-github-client.js";
|
|
4
|
+
import r from "semver";
|
|
5
|
+
async function i(i, o, u) {
|
|
6
|
+
let d = u?.client ?? n(o), f = u?.includeBranches ?? !1, p = u?.style ?? "sha", m = i.filter((e) => e.type === "external" || e.type === "reusable-workflow");
|
|
7
|
+
if (m.length === 0) return [];
|
|
8
|
+
let h = /* @__PURE__ */ new Map();
|
|
9
|
+
for (let e of m) {
|
|
10
|
+
let t = h.get(e.name) ?? [];
|
|
11
|
+
t.push(e), h.set(e.name, t);
|
|
12
12
|
}
|
|
13
|
-
let
|
|
13
|
+
let g = {
|
|
14
14
|
rateLimitError: null,
|
|
15
15
|
rateLimitHit: !1
|
|
16
|
-
},
|
|
17
|
-
if (
|
|
16
|
+
}, _ = await [...h.keys()].reduce((n, i) => n.then(async (n) => {
|
|
17
|
+
if (g.rateLimitHit) return [...n, {
|
|
18
|
+
currentRefType: "unknown",
|
|
18
19
|
publishedAt: null,
|
|
19
20
|
version: null,
|
|
20
21
|
actionName: i,
|
|
@@ -22,62 +23,69 @@ async function checkUpdates(i, o, l) {
|
|
|
22
23
|
}];
|
|
23
24
|
let a = i.split("/");
|
|
24
25
|
if (a.length < 2) return [...n, {
|
|
26
|
+
currentRefType: "unknown",
|
|
25
27
|
publishedAt: null,
|
|
26
28
|
version: null,
|
|
27
29
|
actionName: i,
|
|
28
30
|
sha: null
|
|
29
31
|
}];
|
|
30
|
-
let [o,
|
|
31
|
-
if (!o || !
|
|
32
|
+
let [o, u] = a;
|
|
33
|
+
if (!o || !u) return [...n, {
|
|
34
|
+
currentRefType: "unknown",
|
|
32
35
|
publishedAt: null,
|
|
33
36
|
version: null,
|
|
34
37
|
actionName: i,
|
|
35
38
|
sha: null
|
|
36
39
|
}];
|
|
37
40
|
try {
|
|
38
|
-
let a =
|
|
39
|
-
if (a && !
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
let a = h.get(i)[0]?.version, p = c(a);
|
|
42
|
+
if (a && !s(a) && !t(a)) {
|
|
43
|
+
let e = await d.getRefType(o, u, a);
|
|
44
|
+
if (p = e === "branch" || e === "tag" ? e : p, e === "branch" && !f) return [...n, {
|
|
45
|
+
currentRefType: p,
|
|
46
|
+
skipReason: "branch",
|
|
47
|
+
status: "skipped",
|
|
48
|
+
publishedAt: null,
|
|
49
|
+
version: null,
|
|
50
|
+
actionName: i,
|
|
51
|
+
sha: null
|
|
52
|
+
}];
|
|
53
|
+
}
|
|
54
|
+
let m = await d.getLatestRelease(o, u);
|
|
55
|
+
if (!m) {
|
|
56
|
+
let e = await d.getAllReleases(o, u, 1);
|
|
57
|
+
m = e.find((e) => !e.isPrerelease) ?? e[0] ?? null;
|
|
51
58
|
}
|
|
52
|
-
if (
|
|
53
|
-
let { publishedAt: a, version: s, sha:
|
|
59
|
+
if (m) {
|
|
60
|
+
let { publishedAt: a, version: s, sha: c } = m, f = !1;
|
|
54
61
|
{
|
|
55
|
-
let n =
|
|
56
|
-
|
|
62
|
+
let n = e(s), i = !!(s && s.trim() !== ""), a = i && /^v?\d+$/u.test(s.trim()), o = r.valid(n);
|
|
63
|
+
f = !i || a || !o || !t(s);
|
|
57
64
|
}
|
|
58
|
-
if (
|
|
59
|
-
let a = await
|
|
65
|
+
if (f) {
|
|
66
|
+
let a = await d.getAllTags(o, u, 30);
|
|
60
67
|
if (a.length > 0) {
|
|
61
|
-
let
|
|
62
|
-
v:
|
|
68
|
+
let c = a.filter((e) => t(e.tag)).map((t) => ({
|
|
69
|
+
v: r.valid(e(t.tag)),
|
|
63
70
|
raw: t
|
|
64
71
|
}));
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
let n =
|
|
72
|
+
if (c.length > 0) {
|
|
73
|
+
c.sort((e, t) => {
|
|
74
|
+
let n = r.rcompare(e.v, t.v);
|
|
68
75
|
if (n !== 0) return n;
|
|
69
|
-
let i =
|
|
70
|
-
return
|
|
76
|
+
let i = +!!/\d+\.\d+/u.test(e.raw.tag);
|
|
77
|
+
return +!!/\d+\.\d+/u.test(t.raw.tag) - i;
|
|
71
78
|
});
|
|
72
|
-
let t =
|
|
73
|
-
if (!a ||
|
|
79
|
+
let t = c[0].raw, a = r.valid(e(s) ?? void 0);
|
|
80
|
+
if (!a || r.gt(c[0].v, a) || r.eq(c[0].v, a) && /\d+\.\d+/u.test(t.tag)) {
|
|
74
81
|
let e = t.tag, r = t.sha?.length ? t.sha : null;
|
|
75
82
|
if (!r && e) try {
|
|
76
|
-
r = await
|
|
83
|
+
r = await d.getTagSha(o, u, e);
|
|
77
84
|
} catch (e) {
|
|
78
|
-
if (
|
|
85
|
+
if (l(e)) throw e;
|
|
79
86
|
}
|
|
80
87
|
return [...n, {
|
|
88
|
+
currentRefType: p,
|
|
81
89
|
version: e,
|
|
82
90
|
publishedAt: null,
|
|
83
91
|
sha: r,
|
|
@@ -88,61 +96,66 @@ async function checkUpdates(i, o, l) {
|
|
|
88
96
|
}
|
|
89
97
|
}
|
|
90
98
|
if (s) {
|
|
91
|
-
let e =
|
|
99
|
+
let e = c;
|
|
92
100
|
try {
|
|
93
|
-
|
|
101
|
+
c = await d.getTagSha(o, u, s) ?? e;
|
|
94
102
|
} catch (t) {
|
|
95
|
-
if (
|
|
96
|
-
|
|
103
|
+
if (l(t)) throw t;
|
|
104
|
+
c = e;
|
|
97
105
|
}
|
|
98
106
|
}
|
|
99
107
|
return [...n, {
|
|
108
|
+
currentRefType: p,
|
|
100
109
|
status: "ok",
|
|
101
110
|
publishedAt: a,
|
|
102
111
|
actionName: i,
|
|
103
112
|
version: s,
|
|
104
|
-
sha:
|
|
113
|
+
sha: c
|
|
105
114
|
}];
|
|
106
115
|
}
|
|
107
|
-
let
|
|
108
|
-
if (
|
|
109
|
-
let a =
|
|
110
|
-
v:
|
|
116
|
+
let g = await d.getAllTags(o, u, 30);
|
|
117
|
+
if (g.length > 0) {
|
|
118
|
+
let a = g.filter((e) => t(e.tag)).map((t) => ({
|
|
119
|
+
v: r.valid(e(t.tag)),
|
|
111
120
|
raw: t
|
|
112
121
|
})), s;
|
|
113
122
|
a.length > 0 ? (a.sort((e, t) => {
|
|
114
|
-
let n =
|
|
123
|
+
let n = r.rcompare(e.v, t.v);
|
|
115
124
|
if (n !== 0) return n;
|
|
116
|
-
let i =
|
|
117
|
-
return
|
|
118
|
-
}), s = a[0].raw) : s =
|
|
119
|
-
let
|
|
120
|
-
if (!f &&
|
|
121
|
-
f = await
|
|
125
|
+
let i = +!!/\d+\.\d+/u.test(e.raw.tag);
|
|
126
|
+
return +!!/\d+\.\d+/u.test(t.raw.tag) - i;
|
|
127
|
+
}), s = a[0].raw) : s = g[0];
|
|
128
|
+
let c = s.tag, f = s.sha?.length ? s.sha : null;
|
|
129
|
+
if (!f && c) try {
|
|
130
|
+
f = await d.getTagSha(o, u, c);
|
|
122
131
|
} catch (e) {
|
|
123
|
-
if (
|
|
132
|
+
if (l(e)) throw e;
|
|
124
133
|
}
|
|
125
134
|
return [...n, {
|
|
135
|
+
currentRefType: p,
|
|
126
136
|
status: "ok",
|
|
127
137
|
publishedAt: null,
|
|
128
138
|
actionName: i,
|
|
129
|
-
version:
|
|
139
|
+
version: c,
|
|
130
140
|
sha: f
|
|
131
141
|
}];
|
|
132
142
|
}
|
|
133
143
|
return [...n, {
|
|
144
|
+
currentRefType: p,
|
|
134
145
|
publishedAt: null,
|
|
135
146
|
version: null,
|
|
136
147
|
actionName: i,
|
|
137
148
|
sha: null
|
|
138
149
|
}];
|
|
139
150
|
} catch (e) {
|
|
140
|
-
return e instanceof Error && e.name === "GitHubRateLimitError" ? (
|
|
151
|
+
return e instanceof Error && e.name === "GitHubRateLimitError" ? (g.rateLimitHit = !0, g.rateLimitError = e, [...n, {
|
|
152
|
+
currentRefType: "unknown",
|
|
141
153
|
publishedAt: null,
|
|
142
154
|
version: null,
|
|
143
155
|
actionName: i,
|
|
144
156
|
sha: null
|
|
145
157
|
}]) : (console.warn(`Failed to check ${i}:`, e), [...n, {
|
|
158
|
+
currentRefType: "unknown",
|
|
146
159
|
publishedAt: null,
|
|
147
160
|
version: null,
|
|
148
161
|
actionName: i,
|
|
@@ -150,12 +163,13 @@ async function checkUpdates(i, o, l) {
|
|
|
150
163
|
}]);
|
|
151
164
|
}
|
|
152
165
|
}), Promise.resolve([]));
|
|
153
|
-
if (
|
|
154
|
-
let e = !!(o ?? process.env.GITHUB_TOKEN), t = `${
|
|
166
|
+
if (g.rateLimitError) {
|
|
167
|
+
let e = !!(o ?? process.env.GITHUB_TOKEN), t = `${g.rateLimitError.message || "GitHub API rate limit exceeded."}\n${e ? "Wait for reset or reduce request rate." : "Please set GITHUB_TOKEN environment variable to increase the limit.\nSee: https://github.com/azat-io/actions-up?tab=readme-ov-file#github-token"}`, n = Error(t);
|
|
155
168
|
throw n.name = "GitHubRateLimitError", n;
|
|
156
169
|
}
|
|
157
|
-
let
|
|
158
|
-
for (let e of
|
|
170
|
+
let v = /* @__PURE__ */ new Map();
|
|
171
|
+
for (let e of _) v.set(e.actionName, {
|
|
172
|
+
currentRefType: e.currentRefType,
|
|
159
173
|
publishedAt: e.publishedAt,
|
|
160
174
|
actionName: e.actionName,
|
|
161
175
|
skipReason: e.skipReason,
|
|
@@ -163,70 +177,80 @@ async function checkUpdates(i, o, l) {
|
|
|
163
177
|
status: e.status,
|
|
164
178
|
sha: e.sha
|
|
165
179
|
});
|
|
166
|
-
let
|
|
167
|
-
for (let e of
|
|
168
|
-
let t =
|
|
169
|
-
t ?
|
|
180
|
+
let y = [];
|
|
181
|
+
for (let e of m) {
|
|
182
|
+
let t = v.get(e.name);
|
|
183
|
+
t ? y.push(a(e, {
|
|
170
184
|
publishedAt: t.publishedAt,
|
|
171
185
|
version: t.version,
|
|
172
186
|
sha: t.sha
|
|
173
187
|
}, {
|
|
188
|
+
currentRefType: t.currentRefType,
|
|
174
189
|
skipReason: t.skipReason,
|
|
175
|
-
status: t.status
|
|
176
|
-
|
|
190
|
+
status: t.status,
|
|
191
|
+
style: p
|
|
192
|
+
})) : y.push(a(e, {
|
|
177
193
|
publishedAt: null,
|
|
178
194
|
version: null,
|
|
179
195
|
sha: null
|
|
196
|
+
}, {
|
|
197
|
+
currentRefType: c(e.version),
|
|
198
|
+
style: p
|
|
180
199
|
}));
|
|
181
200
|
}
|
|
182
|
-
return
|
|
201
|
+
return y;
|
|
183
202
|
}
|
|
184
|
-
function
|
|
185
|
-
let { version: a, sha: c, publishedAt: l } = n, u = t.version ?? "unknown", d =
|
|
186
|
-
if (
|
|
203
|
+
function a(t, n, i) {
|
|
204
|
+
let { version: a, sha: c, publishedAt: l } = n, u = t.version ?? "unknown", d = e(u), f = a ? e(a) : null, p = i.currentRefType, { style: m } = i, h = i.status ?? "ok", g = i.skipReason, _ = !1, v = !1;
|
|
205
|
+
if (h === "skipped") return {
|
|
206
|
+
currentRefType: p,
|
|
187
207
|
currentVersion: u,
|
|
188
208
|
isBreaking: !1,
|
|
189
209
|
hasUpdate: !1,
|
|
190
210
|
latestVersion: a,
|
|
191
211
|
publishedAt: l,
|
|
192
|
-
skipReason:
|
|
212
|
+
skipReason: g,
|
|
193
213
|
latestSha: c,
|
|
194
214
|
action: t,
|
|
195
|
-
status:
|
|
215
|
+
status: h
|
|
196
216
|
};
|
|
197
|
-
if (d &&
|
|
217
|
+
if (d && s(d)) c ? _ = !o(d, c) : f && (_ = !0);
|
|
198
218
|
else if (d && f) {
|
|
199
|
-
let e =
|
|
219
|
+
let e = r.valid(d), n = r.valid(f);
|
|
200
220
|
if (e && n) {
|
|
201
|
-
if (
|
|
202
|
-
let t =
|
|
203
|
-
|
|
221
|
+
if (_ = r.lt(e, n), _) {
|
|
222
|
+
let t = r.major(e);
|
|
223
|
+
v = r.major(n) > t;
|
|
204
224
|
}
|
|
205
|
-
!
|
|
206
|
-
} else d !== f && (
|
|
225
|
+
!_ && r.eq(e, n) && !s(t.version) && c && m === "sha" && (_ = !0, v = !1);
|
|
226
|
+
} else d !== f && (_ = !0);
|
|
207
227
|
}
|
|
208
228
|
return {
|
|
229
|
+
currentRefType: p,
|
|
209
230
|
currentVersion: u,
|
|
210
231
|
latestVersion: a,
|
|
211
232
|
publishedAt: l,
|
|
212
|
-
isBreaking:
|
|
213
|
-
skipReason:
|
|
233
|
+
isBreaking: v,
|
|
234
|
+
skipReason: g,
|
|
214
235
|
latestSha: c,
|
|
215
|
-
hasUpdate:
|
|
236
|
+
hasUpdate: _,
|
|
216
237
|
action: t,
|
|
217
|
-
status:
|
|
238
|
+
status: h
|
|
218
239
|
};
|
|
219
240
|
}
|
|
220
|
-
function
|
|
241
|
+
function o(e, t) {
|
|
221
242
|
let n = e.replace(/^v/u, ""), r = t.replace(/^v/u, ""), i = Math.min(n.length, r.length);
|
|
222
243
|
return i < 7 ? !1 : n.slice(0, Math.max(0, i)).toLowerCase() === r.slice(0, Math.max(0, i)).toLowerCase();
|
|
223
244
|
}
|
|
224
|
-
function
|
|
245
|
+
function s(e) {
|
|
225
246
|
if (!e) return !1;
|
|
226
247
|
let t = e.replace(/^v/u, "");
|
|
227
248
|
return /^[0-9a-f]{7,40}$/iu.test(t);
|
|
228
249
|
}
|
|
229
|
-
function
|
|
250
|
+
function c(e) {
|
|
251
|
+
return e ? s(e) ? "sha" : t(e) ? "tag" : "unknown" : "unknown";
|
|
252
|
+
}
|
|
253
|
+
function l(e) {
|
|
230
254
|
return e instanceof Error && e.name === "GitHubRateLimitError";
|
|
231
255
|
}
|
|
232
|
-
export { checkUpdates };
|
|
256
|
+
export { i as checkUpdates };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { resolveGitHubTokenSync } from "./resolve-github-token-sync.js";
|
|
2
|
-
import { getReferenceType } from "./get-reference-type.js";
|
|
3
|
-
import { getLatestRelease } from "./get-latest-release.js";
|
|
4
|
-
import { getAllReleases } from "./get-all-releases.js";
|
|
5
|
-
import { getTagInfo } from "./get-tag-info.js";
|
|
6
|
-
import { getAllTags } from "./get-all-tags.js";
|
|
7
|
-
import { getTagSha } from "./get-tag-sha.js";
|
|
8
|
-
function
|
|
9
|
-
let c = s ?? process.env.GITHUB_TOKEN ??
|
|
1
|
+
import { resolveGitHubTokenSync as e } from "./resolve-github-token-sync.js";
|
|
2
|
+
import { getReferenceType as t } from "./get-reference-type.js";
|
|
3
|
+
import { getLatestRelease as n } from "./get-latest-release.js";
|
|
4
|
+
import { getAllReleases as r } from "./get-all-releases.js";
|
|
5
|
+
import { getTagInfo as i } from "./get-tag-info.js";
|
|
6
|
+
import { getAllTags as a } from "./get-all-tags.js";
|
|
7
|
+
import { getTagSha as o } from "./get-tag-sha.js";
|
|
8
|
+
function s(s) {
|
|
9
|
+
let c = s ?? process.env.GITHUB_TOKEN ?? e(), l = {
|
|
10
10
|
caches: {
|
|
11
11
|
refType: /* @__PURE__ */ new Map(),
|
|
12
12
|
tagInfo: /* @__PURE__ */ new Map(),
|
|
@@ -22,33 +22,33 @@ function createGitHubClient(s) {
|
|
|
22
22
|
remaining: l.rateLimitRemaining,
|
|
23
23
|
resetAt: l.rateLimitReset
|
|
24
24
|
}),
|
|
25
|
-
getRefType: (e,
|
|
26
|
-
reference:
|
|
25
|
+
getRefType: (e, n, r) => t(l, {
|
|
26
|
+
reference: r,
|
|
27
27
|
owner: e,
|
|
28
|
-
repo:
|
|
28
|
+
repo: n
|
|
29
29
|
}),
|
|
30
30
|
shouldWaitForRateLimit: (e = 100) => l.rateLimitRemaining < e,
|
|
31
|
-
getAllReleases: (e,
|
|
31
|
+
getAllReleases: (e, t, n) => r(l, {
|
|
32
32
|
owner: e,
|
|
33
|
-
limit:
|
|
34
|
-
repo:
|
|
33
|
+
limit: n,
|
|
34
|
+
repo: t
|
|
35
35
|
}),
|
|
36
|
-
getAllTags: (e,
|
|
36
|
+
getAllTags: (e, t, n) => a(l, {
|
|
37
37
|
owner: e,
|
|
38
|
-
limit:
|
|
39
|
-
repo:
|
|
38
|
+
limit: n,
|
|
39
|
+
repo: t
|
|
40
40
|
}),
|
|
41
|
-
getTagInfo: (e,
|
|
41
|
+
getTagInfo: (e, t, n) => i(l, {
|
|
42
42
|
owner: e,
|
|
43
|
-
repo:
|
|
44
|
-
tag:
|
|
43
|
+
repo: t,
|
|
44
|
+
tag: n
|
|
45
45
|
}),
|
|
46
|
-
getLatestRelease: (e,
|
|
47
|
-
getTagSha: (e,
|
|
46
|
+
getLatestRelease: (e, t) => n(l, e, t),
|
|
47
|
+
getTagSha: (e, t, n) => o(l, {
|
|
48
48
|
owner: e,
|
|
49
|
-
repo:
|
|
50
|
-
tag:
|
|
49
|
+
repo: t,
|
|
50
|
+
tag: n
|
|
51
51
|
})
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
export { createGitHubClient };
|
|
54
|
+
export { s as createGitHubClient };
|
|
@@ -1,28 +1,28 @@
|
|
|
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
|
-
let { limit:
|
|
5
|
+
let { limit: t = 10, owner: a, repo: o } = i, s = (await e(n, `/repos/${a}/${o}/releases?per_page=${t}`)).data, c = [], l = 0;
|
|
6
6
|
for (let e of s) {
|
|
7
|
-
let
|
|
8
|
-
l === 0 && e.tag_name && (
|
|
7
|
+
let t = null;
|
|
8
|
+
l === 0 && e.tag_name && (t = r(e.target_commitish) ? e.target_commitish : null), c.push({
|
|
9
9
|
publishedAt: new Date(e.published_at),
|
|
10
10
|
name: e.name ?? e.tag_name,
|
|
11
11
|
description: e.body ?? null,
|
|
12
12
|
isPrerelease: e.prerelease,
|
|
13
13
|
version: e.tag_name,
|
|
14
14
|
url: e.html_url,
|
|
15
|
-
sha:
|
|
15
|
+
sha: t
|
|
16
16
|
}), l++;
|
|
17
17
|
}
|
|
18
18
|
return c;
|
|
19
19
|
} catch (e) {
|
|
20
|
-
throw e instanceof Error && e.message.includes("rate limit") ? new
|
|
20
|
+
throw e instanceof Error && e.message.includes("rate limit") ? new t(n.rateLimitReset) : e;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function r(e) {
|
|
24
24
|
if (typeof e != "string" || e.trim() === "") return !1;
|
|
25
|
-
let
|
|
26
|
-
return /^[0-9a-f]{7,40}$/iu.test(
|
|
25
|
+
let t = e.replace(/^v/u, "");
|
|
26
|
+
return /^[0-9a-f]{7,40}$/iu.test(t);
|
|
27
27
|
}
|
|
28
|
-
export { getAllReleases };
|
|
28
|
+
export { n as getAllReleases };
|
|
@@ -1,11 +1,11 @@
|
|
|
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 { limit: r = 30, owner: i, repo: a } = n;
|
|
4
|
-
return (await
|
|
4
|
+
return (await e(t, `/repos/${i}/${a}/tags?per_page=${r}`)).data.map((e) => ({
|
|
5
5
|
sha: e.commit.sha,
|
|
6
6
|
tag: e.name,
|
|
7
7
|
message: null,
|
|
8
8
|
date: null
|
|
9
9
|
}));
|
|
10
10
|
}
|
|
11
|
-
export { getAllTags };
|
|
11
|
+
export { t as getAllTags };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isSemverLike } from "../versions/is-semver-like.js";
|
|
2
|
-
import { findCompatibleTag } from "../versions/find-compatible-tag.js";
|
|
3
|
-
async function
|
|
1
|
+
import { isSemverLike as e } from "../versions/is-semver-like.js";
|
|
2
|
+
import { findCompatibleTag as t } from "../versions/find-compatible-tag.js";
|
|
3
|
+
async function n(n, r) {
|
|
4
4
|
let { currentVersion: i, actionName: a, mode: o } = r;
|
|
5
|
-
if (!i || !
|
|
5
|
+
if (!i || !e(i)) return null;
|
|
6
6
|
let s = a.split("/");
|
|
7
7
|
if (s.length < 2) return null;
|
|
8
8
|
let [c, l] = s;
|
|
@@ -16,7 +16,7 @@ async function getCompatibleUpdate(n, r) {
|
|
|
16
16
|
}
|
|
17
17
|
u.set(a, f);
|
|
18
18
|
}
|
|
19
|
-
let p =
|
|
19
|
+
let p = t(f, i, o);
|
|
20
20
|
if (!p) return null;
|
|
21
21
|
let m = p.tag, h = p.sha?.length ? p.sha : null;
|
|
22
22
|
if (!h) {
|
|
@@ -37,4 +37,4 @@ async function getCompatibleUpdate(n, r) {
|
|
|
37
37
|
sha: h
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
export { getCompatibleUpdate };
|
|
40
|
+
export { n as getCompatibleUpdate };
|
|
@@ -1,25 +1,25 @@
|
|
|
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, a) {
|
|
4
4
|
try {
|
|
5
|
-
let
|
|
5
|
+
let t = (await e(n, `/repos/${i}/${a}/releases/latest`)).data, o = r(t.target_commitish) ? t.target_commitish : null;
|
|
6
6
|
return {
|
|
7
|
-
publishedAt: new Date(
|
|
8
|
-
name:
|
|
9
|
-
description:
|
|
10
|
-
isPrerelease:
|
|
11
|
-
version:
|
|
12
|
-
url:
|
|
7
|
+
publishedAt: new Date(t.published_at),
|
|
8
|
+
name: t.name ?? t.tag_name,
|
|
9
|
+
description: t.body ?? null,
|
|
10
|
+
isPrerelease: t.prerelease,
|
|
11
|
+
version: t.tag_name,
|
|
12
|
+
url: t.html_url,
|
|
13
13
|
sha: o
|
|
14
14
|
};
|
|
15
15
|
} catch (e) {
|
|
16
16
|
if (e && typeof e == "object" && "status" in e && e.status === 404) return null;
|
|
17
|
-
throw e instanceof Error && e.message.includes("rate limit") ? new
|
|
17
|
+
throw e instanceof Error && e.message.includes("rate limit") ? new t(n.rateLimitReset) : e;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function r(e) {
|
|
21
21
|
if (typeof e != "string" || e.trim() === "") return !1;
|
|
22
|
-
let
|
|
23
|
-
return /^[0-9a-f]{7,40}$/iu.test(
|
|
22
|
+
let t = e.replace(/^v/u, "");
|
|
23
|
+
return /^[0-9a-f]{7,40}$/iu.test(t);
|
|
24
24
|
}
|
|
25
|
-
export { getLatestRelease };
|
|
25
|
+
export { n as getLatestRelease };
|