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,9 +1,10 @@
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 semver from "semver";
5
- async function checkUpdates(i, o, u) {
6
- let d = u?.client ?? createGitHubClient(o), f = u?.includeBranches ?? !1, p = u?.style ?? "sha", m = i.filter((e) => e.type === "external" || e.type === "reusable-workflow");
1
+ import { isSemverLike as e } from "../versions/is-semver-like.js";
2
+ import { preserveTagFormat as t } from "../versions/preserve-tag-format.js";
3
+ import { normalizeVersion as n } from "../versions/normalize-version.js";
4
+ import { createGitHubClient as r } from "./create-github-client.js";
5
+ import i from "semver";
6
+ async function a(t, a, s) {
7
+ let d = s?.client ?? r(a), f = s?.includeBranches ?? !1, p = s?.style ?? "sha", m = t.filter((e) => e.type === "external" || e.type === "reusable-workflow");
7
8
  if (m.length === 0) return [];
8
9
  let h = /* @__PURE__ */ new Map();
9
10
  for (let e of m) {
@@ -13,158 +14,158 @@ async function checkUpdates(i, o, u) {
13
14
  let g = {
14
15
  rateLimitError: null,
15
16
  rateLimitHit: !1
16
- }, _ = await [...h.keys()].reduce((n, i) => n.then(async (n) => {
17
- if (g.rateLimitHit) return [...n, {
17
+ }, _ = await [...h.keys()].reduce((t, r) => t.then(async (t) => {
18
+ if (g.rateLimitHit) return [...t, {
18
19
  currentRefType: "unknown",
19
20
  publishedAt: null,
20
21
  version: null,
21
- actionName: i,
22
+ actionName: r,
22
23
  sha: null
23
24
  }];
24
- let a = i.split("/");
25
- if (a.length < 2) return [...n, {
25
+ let a = r.split("/");
26
+ if (a.length < 2) return [...t, {
26
27
  currentRefType: "unknown",
27
28
  publishedAt: null,
28
29
  version: null,
29
- actionName: i,
30
+ actionName: r,
30
31
  sha: null
31
32
  }];
32
- let [o, u] = a;
33
- if (!o || !u) return [...n, {
33
+ let [o, s] = a;
34
+ if (!o || !s) return [...t, {
34
35
  currentRefType: "unknown",
35
36
  publishedAt: null,
36
37
  version: null,
37
- actionName: i,
38
+ actionName: r,
38
39
  sha: null
39
40
  }];
40
41
  try {
41
- let a = h.get(i)[0]?.version, p = deriveCurrentReferenceType(a);
42
- if (a && !isSha(a) && !isSemverLike(a)) {
43
- let e = await d.getRefType(o, u, a);
44
- if (p = e === "branch" || e === "tag" ? e : p, e === "branch" && !f) return [...n, {
42
+ let a = h.get(r)[0]?.version, p = l(a);
43
+ if (a && !c(a) && !e(a)) {
44
+ let e = await d.getRefType(o, s, a);
45
+ if (p = e === "branch" || e === "tag" ? e : p, e === "branch" && !f) return [...t, {
45
46
  currentRefType: p,
46
47
  skipReason: "branch",
47
48
  status: "skipped",
48
49
  publishedAt: null,
49
50
  version: null,
50
- actionName: i,
51
+ actionName: r,
51
52
  sha: null
52
53
  }];
53
54
  }
54
- let m = await d.getLatestRelease(o, u);
55
+ let m = await d.getLatestRelease(o, s);
55
56
  if (!m) {
56
- let e = await d.getAllReleases(o, u, 1);
57
+ let e = await d.getAllReleases(o, s, 1);
57
58
  m = e.find((e) => !e.isPrerelease) ?? e[0] ?? null;
58
59
  }
59
60
  if (m) {
60
- let { publishedAt: a, version: s, sha: c } = m, f = !1;
61
+ let { publishedAt: a, version: c, sha: l } = m, f = !1;
61
62
  {
62
- let n = normalizeVersion(s), i = !!(s && s.trim() !== ""), a = i && /^v?\d+$/u.test(s.trim()), o = semver.valid(n);
63
- f = !i || a || !o || !isSemverLike(s);
63
+ let t = n(c), r = !!(c && c.trim() !== ""), a = r && /^v?\d+$/u.test(c.trim()), o = i.valid(t);
64
+ f = !r || a || !o || !e(c);
64
65
  }
65
66
  if (f) {
66
- let a = await d.getAllTags(o, u, 30);
67
+ let a = await d.getAllTags(o, s, 30);
67
68
  if (a.length > 0) {
68
- let c = a.filter((e) => isSemverLike(e.tag)).map((t) => ({
69
- v: semver.valid(normalizeVersion(t.tag)),
70
- raw: t
69
+ let l = a.filter((t) => e(t.tag)).map((e) => ({
70
+ v: i.valid(n(e.tag)),
71
+ raw: e
71
72
  }));
72
- if (c.length > 0) {
73
- c.sort((e, t) => {
74
- let n = semver.rcompare(e.v, t.v);
73
+ if (l.length > 0) {
74
+ l.sort((e, t) => {
75
+ let n = i.rcompare(e.v, t.v);
75
76
  if (n !== 0) return n;
76
- let i = /\d+\.\d+/u.test(e.raw.tag) ? 1 : 0;
77
- return (/\d+\.\d+/u.test(t.raw.tag) ? 1 : 0) - i;
77
+ let r = +!!/\d+\.\d+/u.test(e.raw.tag);
78
+ return +!!/\d+\.\d+/u.test(t.raw.tag) - r;
78
79
  });
79
- let t = c[0].raw, a = semver.valid(normalizeVersion(s) ?? void 0);
80
- if (!a || semver.gt(c[0].v, a) || semver.eq(c[0].v, a) && /\d+\.\d+/u.test(t.tag)) {
81
- let e = t.tag, r = t.sha?.length ? t.sha : null;
82
- if (!r && e) try {
83
- r = await d.getTagSha(o, u, e);
80
+ let e = l[0].raw, a = i.valid(n(c) ?? void 0);
81
+ if (!a || i.gt(l[0].v, a) || i.eq(l[0].v, a) && /\d+\.\d+/u.test(e.tag)) {
82
+ let n = e.tag, i = e.sha?.length ? e.sha : null;
83
+ if (!i && n) try {
84
+ i = await d.getTagSha(o, s, n);
84
85
  } catch (e) {
85
- if (isRateLimitError(e)) throw e;
86
+ if (u(e)) throw e;
86
87
  }
87
- return [...n, {
88
+ return [...t, {
88
89
  currentRefType: p,
89
- version: e,
90
+ version: n,
90
91
  publishedAt: null,
91
- sha: r,
92
- actionName: i
92
+ sha: i,
93
+ actionName: r
93
94
  }];
94
95
  }
95
96
  }
96
97
  }
97
98
  }
98
- if (s) {
99
- let e = c;
99
+ if (c) {
100
+ let e = l;
100
101
  try {
101
- c = await d.getTagSha(o, u, s) ?? e;
102
+ l = await d.getTagSha(o, s, c) ?? e;
102
103
  } catch (t) {
103
- if (isRateLimitError(t)) throw t;
104
- c = e;
104
+ if (u(t)) throw t;
105
+ l = e;
105
106
  }
106
107
  }
107
- return [...n, {
108
+ return [...t, {
108
109
  currentRefType: p,
109
110
  status: "ok",
110
111
  publishedAt: a,
111
- actionName: i,
112
- version: s,
113
- sha: c
112
+ actionName: r,
113
+ version: c,
114
+ sha: l
114
115
  }];
115
116
  }
116
- let g = await d.getAllTags(o, u, 30);
117
+ let g = await d.getAllTags(o, s, 30);
117
118
  if (g.length > 0) {
118
- let a = g.filter((e) => isSemverLike(e.tag)).map((t) => ({
119
- v: semver.valid(normalizeVersion(t.tag)),
120
- raw: t
121
- })), s;
119
+ let a = g.filter((t) => e(t.tag)).map((e) => ({
120
+ v: i.valid(n(e.tag)),
121
+ raw: e
122
+ })), c;
122
123
  a.length > 0 ? (a.sort((e, t) => {
123
- let n = semver.rcompare(e.v, t.v);
124
+ let n = i.rcompare(e.v, t.v);
124
125
  if (n !== 0) return n;
125
- let i = /\d+\.\d+/u.test(e.raw.tag) ? 1 : 0;
126
- return (/\d+\.\d+/u.test(t.raw.tag) ? 1 : 0) - 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);
126
+ let r = +!!/\d+\.\d+/u.test(e.raw.tag);
127
+ return +!!/\d+\.\d+/u.test(t.raw.tag) - r;
128
+ }), c = a[0].raw) : c = g[0];
129
+ let l = c.tag, f = c.sha?.length ? c.sha : null;
130
+ if (!f && l) try {
131
+ f = await d.getTagSha(o, s, l);
131
132
  } catch (e) {
132
- if (isRateLimitError(e)) throw e;
133
+ if (u(e)) throw e;
133
134
  }
134
- return [...n, {
135
+ return [...t, {
135
136
  currentRefType: p,
136
137
  status: "ok",
137
138
  publishedAt: null,
138
- actionName: i,
139
- version: c,
139
+ actionName: r,
140
+ version: l,
140
141
  sha: f
141
142
  }];
142
143
  }
143
- return [...n, {
144
+ return [...t, {
144
145
  currentRefType: p,
145
146
  publishedAt: null,
146
147
  version: null,
147
- actionName: i,
148
+ actionName: r,
148
149
  sha: null
149
150
  }];
150
151
  } catch (e) {
151
- return e instanceof Error && e.name === "GitHubRateLimitError" ? (g.rateLimitHit = !0, g.rateLimitError = e, [...n, {
152
+ return e instanceof Error && e.name === "GitHubRateLimitError" ? (g.rateLimitHit = !0, g.rateLimitError = e, [...t, {
152
153
  currentRefType: "unknown",
153
154
  publishedAt: null,
154
155
  version: null,
155
- actionName: i,
156
+ actionName: r,
156
157
  sha: null
157
- }]) : (console.warn(`Failed to check ${i}:`, e), [...n, {
158
+ }]) : (console.warn(`Failed to check ${r}:`, e), [...t, {
158
159
  currentRefType: "unknown",
159
160
  publishedAt: null,
160
161
  version: null,
161
- actionName: i,
162
+ actionName: r,
162
163
  sha: null
163
164
  }]);
164
165
  }
165
166
  }), Promise.resolve([]));
166
167
  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);
168
+ let e = !!(a ?? 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);
168
169
  throw n.name = "GitHubRateLimitError", n;
169
170
  }
170
171
  let v = /* @__PURE__ */ new Map();
@@ -180,7 +181,7 @@ async function checkUpdates(i, o, u) {
180
181
  let y = [];
181
182
  for (let e of m) {
182
183
  let t = v.get(e.name);
183
- t ? y.push(createUpdate(e, {
184
+ t ? y.push(o(e, {
184
185
  publishedAt: t.publishedAt,
185
186
  version: t.version,
186
187
  sha: t.sha
@@ -189,68 +190,68 @@ async function checkUpdates(i, o, u) {
189
190
  skipReason: t.skipReason,
190
191
  status: t.status,
191
192
  style: p
192
- })) : y.push(createUpdate(e, {
193
+ })) : y.push(o(e, {
193
194
  publishedAt: null,
194
195
  version: null,
195
196
  sha: null
196
197
  }, {
197
- currentRefType: deriveCurrentReferenceType(e.version),
198
+ currentRefType: l(e.version),
198
199
  style: p
199
200
  }));
200
201
  }
201
202
  return y;
202
203
  }
203
- function createUpdate(t, n, i) {
204
- let { version: a, sha: c, publishedAt: l } = n, u = t.version ?? "unknown", d = normalizeVersion(u), f = a ? normalizeVersion(a) : null, p = i.currentRefType, { style: m } = i, h = i.status ?? "ok", g = i.skipReason, _ = !1, v = !1;
205
- if (h === "skipped") return {
204
+ function o(e, r, a) {
205
+ let { version: o, sha: l, publishedAt: u } = r, d = e.version ?? "unknown", f = n(d), p = a.currentRefType, { style: m } = a, h = (m === "preserve" && p === "tag" ? t(d, o) : null) ?? o, g = h ? n(h) : null, _ = a.status ?? "ok", v = a.skipReason, y = !1, b = !1;
206
+ if (_ === "skipped") return {
206
207
  currentRefType: p,
207
- currentVersion: u,
208
+ currentVersion: d,
208
209
  isBreaking: !1,
209
210
  hasUpdate: !1,
210
- latestVersion: a,
211
- publishedAt: l,
212
- skipReason: g,
213
- latestSha: c,
214
- action: t,
215
- status: h
211
+ latestVersion: o,
212
+ publishedAt: u,
213
+ skipReason: v,
214
+ latestSha: l,
215
+ action: e,
216
+ status: _
216
217
  };
217
- if (d && isSha(d)) c ? _ = !compareSha(d, c) : f && (_ = !0);
218
- else if (d && f) {
219
- let e = semver.valid(d), n = semver.valid(f);
220
- if (e && n) {
221
- if (_ = semver.lt(e, n), _) {
222
- let t = semver.major(e);
223
- v = semver.major(n) > t;
218
+ if (f && c(f)) l ? y = !s(f, l) : g && (y = !0);
219
+ else if (f && g) {
220
+ let t = i.valid(f), n = i.valid(g);
221
+ if (t && n) {
222
+ if (y = i.lt(t, n), y) {
223
+ let e = i.major(t);
224
+ b = i.major(n) > e;
224
225
  }
225
- !_ && semver.eq(e, n) && !isSha(t.version) && c && m === "sha" && (_ = !0, v = !1);
226
- } else d !== f && (_ = !0);
226
+ !y && i.eq(t, n) && !c(e.version) && l && m === "sha" && (y = !0, b = !1);
227
+ } else f !== g && (y = !0);
227
228
  }
228
229
  return {
229
230
  currentRefType: p,
230
- currentVersion: u,
231
- latestVersion: a,
232
- publishedAt: l,
233
- isBreaking: v,
234
- skipReason: g,
235
- latestSha: c,
236
- hasUpdate: _,
237
- action: t,
238
- status: h
231
+ currentVersion: d,
232
+ latestVersion: o,
233
+ publishedAt: u,
234
+ isBreaking: b,
235
+ skipReason: v,
236
+ latestSha: l,
237
+ hasUpdate: y,
238
+ action: e,
239
+ status: _
239
240
  };
240
241
  }
241
- function compareSha(e, t) {
242
+ function s(e, t) {
242
243
  let n = e.replace(/^v/u, ""), r = t.replace(/^v/u, ""), i = Math.min(n.length, r.length);
243
244
  return i < 7 ? !1 : n.slice(0, Math.max(0, i)).toLowerCase() === r.slice(0, Math.max(0, i)).toLowerCase();
244
245
  }
245
- function isSha(e) {
246
+ function c(e) {
246
247
  if (!e) return !1;
247
248
  let t = e.replace(/^v/u, "");
248
249
  return /^[0-9a-f]{7,40}$/iu.test(t);
249
250
  }
250
- function deriveCurrentReferenceType(e) {
251
- return e ? isSha(e) ? "sha" : isSemverLike(e) ? "tag" : "unknown" : "unknown";
251
+ function l(t) {
252
+ return t ? c(t) ? "sha" : e(t) ? "tag" : "unknown" : "unknown";
252
253
  }
253
- function isRateLimitError(e) {
254
+ function u(e) {
254
255
  return e instanceof Error && e.name === "GitHubRateLimitError";
255
256
  }
256
- export { checkUpdates };
257
+ export { a 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 createGitHubClient(s) {
9
- let c = s ?? process.env.GITHUB_TOKEN ?? resolveGitHubTokenSync(), l = {
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, a, o) => getReferenceType(l, {
26
- reference: o,
25
+ getRefType: (e, n, r) => t(l, {
26
+ reference: r,
27
27
  owner: e,
28
- repo: a
28
+ repo: n
29
29
  }),
30
30
  shouldWaitForRateLimit: (e = 100) => l.rateLimitRemaining < e,
31
- getAllReleases: (e, i, a) => getAllReleases(l, {
31
+ getAllReleases: (e, t, n) => r(l, {
32
32
  owner: e,
33
- limit: a,
34
- repo: i
33
+ limit: n,
34
+ repo: t
35
35
  }),
36
- getAllTags: (e, i, a) => getAllTags(l, {
36
+ getAllTags: (e, t, n) => a(l, {
37
37
  owner: e,
38
- limit: a,
39
- repo: i
38
+ limit: n,
39
+ repo: t
40
40
  }),
41
- getTagInfo: (e, i, a) => getTagInfo(l, {
41
+ getTagInfo: (e, t, n) => i(l, {
42
42
  owner: e,
43
- repo: i,
44
- tag: a
43
+ repo: t,
44
+ tag: n
45
45
  }),
46
- getLatestRelease: (e, i) => getLatestRelease(l, e, i),
47
- getTagSha: (e, i, a) => getTagSha(l, {
46
+ getLatestRelease: (e, t) => n(l, e, t),
47
+ getTagSha: (e, t, n) => o(l, {
48
48
  owner: e,
49
- repo: i,
50
- tag: a
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 getAllReleases(r, i) {
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: n = 10, owner: a, repo: o } = i, s = (await makeRequest(r, `/repos/${a}/${o}/releases?per_page=${n}`)).data, c = [], l = 0;
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 n = null;
8
- l === 0 && e.tag_name && (n = isLikelySha(e.target_commitish) ? e.target_commitish : null), c.push({
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: n
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 GitHubRateLimitError(r.rateLimitReset) : e;
20
+ throw e instanceof Error && e.message.includes("rate limit") ? new t(n.rateLimitReset) : e;
21
21
  }
22
22
  }
23
- function isLikelySha(e) {
23
+ function r(e) {
24
24
  if (typeof e != "string" || e.trim() === "") return !1;
25
- let n = e.replace(/^v/u, "");
26
- return /^[0-9a-f]{7,40}$/iu.test(n);
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 getAllTags(t, n) {
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 makeRequest(t, `/repos/${i}/${a}/tags?per_page=${r}`)).data.map((e) => ({
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 getCompatibleUpdate(n, r) {
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 || !isSemverLike(i)) return null;
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 = findCompatibleTag(f, i, o);
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 getLatestRelease(r, i, a) {
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 n = (await makeRequest(r, `/repos/${i}/${a}/releases/latest`)).data, o = isLikelySha(n.target_commitish) ? n.target_commitish : null;
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(n.published_at),
8
- name: n.name ?? n.tag_name,
9
- description: n.body ?? null,
10
- isPrerelease: n.prerelease,
11
- version: n.tag_name,
12
- url: n.html_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 GitHubRateLimitError(r.rateLimitReset) : e;
17
+ throw e instanceof Error && e.message.includes("rate limit") ? new t(n.rateLimitReset) : e;
18
18
  }
19
19
  }
20
- function isLikelySha(e) {
20
+ function r(e) {
21
21
  if (typeof e != "string" || e.trim() === "") return !1;
22
- let n = e.replace(/^v/u, "");
23
- return /^[0-9a-f]{7,40}$/iu.test(n);
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 };
@@ -1,15 +1,15 @@
1
- import { makeRequest } from "./make-request.js";
2
- async function getReferenceType(t, n) {
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 makeRequest(t, `/repos/${i}/${a}/git/refs/tags/${r}`), t.caches.refType.set(o, "tag"), "tag";
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 makeRequest(t, `/repos/${i}/${a}/git/refs/heads/${r}`), t.caches.refType.set(o, "branch"), "branch";
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 getTagInfo(n, i) {
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 makeRequest(n, `/repos/${t}/${a}/releases/tags/${s}`)).data, o = i.published_at ? new Date(i.published_at) : null, l = i.body ?? null, u = null;
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 makeRequest(n, `/repos/${t}/${a}/git/refs/tags/${s}`)).data.object;
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 makeRequest(n, `/repos/${t}/${a}/git/tags/${i}`)).data;
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 makeRequest(n, `/repos/${t}/${a}/git/commits/${i}`)).data;
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
- isLikelySha(i.target_commitish) && (u = i.target_commitish);
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 makeRequest(n, `/repos/${t}/${a}/git/refs/tags/${s}`)).data, { sha: i } = r.object, o = null, l = null;
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 makeRequest(n, `/repos/${t}/${a}/git/tags/${i}`)).data;
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 makeRequest(n, `/repos/${t}/${a}/git/commits/${i}`)).data;
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 GitHubRateLimitError(n.rateLimitReset) : e;
59
+ throw e instanceof Error && e.message.includes("rate limit") ? new t(n.rateLimitReset) : e;
60
60
  }
61
61
  }
62
- function isLikelySha(e) {
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 };