actions-up 1.14.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.
Files changed (62) 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 +42 -42
  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 +21 -21
  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 +2 -2
  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/read-inline-version-comment.js +4 -4
  61. package/dist/package.js +2 -2
  62. package/package.json +1 -1
@@ -1,9 +1,9 @@
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 { 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
7
  if (m.length === 0) return [];
8
8
  let h = /* @__PURE__ */ new Map();
9
9
  for (let e of m) {
@@ -38,8 +38,8 @@ async function checkUpdates(i, o, u) {
38
38
  sha: null
39
39
  }];
40
40
  try {
41
- let a = h.get(i)[0]?.version, p = deriveCurrentReferenceType(a);
42
- if (a && !isSha(a) && !isSemverLike(a)) {
41
+ let a = h.get(i)[0]?.version, p = c(a);
42
+ if (a && !s(a) && !t(a)) {
43
43
  let e = await d.getRefType(o, u, a);
44
44
  if (p = e === "branch" || e === "tag" ? e : p, e === "branch" && !f) return [...n, {
45
45
  currentRefType: p,
@@ -59,30 +59,30 @@ async function checkUpdates(i, o, u) {
59
59
  if (m) {
60
60
  let { publishedAt: a, version: s, sha: c } = m, f = !1;
61
61
  {
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);
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);
64
64
  }
65
65
  if (f) {
66
66
  let a = await d.getAllTags(o, u, 30);
67
67
  if (a.length > 0) {
68
- let c = a.filter((e) => isSemverLike(e.tag)).map((t) => ({
69
- v: semver.valid(normalizeVersion(t.tag)),
68
+ let c = a.filter((e) => t(e.tag)).map((t) => ({
69
+ v: r.valid(e(t.tag)),
70
70
  raw: t
71
71
  }));
72
72
  if (c.length > 0) {
73
73
  c.sort((e, t) => {
74
- let n = semver.rcompare(e.v, t.v);
74
+ let n = r.rcompare(e.v, t.v);
75
75
  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;
76
+ let i = +!!/\d+\.\d+/u.test(e.raw.tag);
77
+ return +!!/\d+\.\d+/u.test(t.raw.tag) - i;
78
78
  });
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)) {
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)) {
81
81
  let e = t.tag, r = t.sha?.length ? t.sha : null;
82
82
  if (!r && e) try {
83
83
  r = await d.getTagSha(o, u, e);
84
84
  } catch (e) {
85
- if (isRateLimitError(e)) throw e;
85
+ if (l(e)) throw e;
86
86
  }
87
87
  return [...n, {
88
88
  currentRefType: p,
@@ -100,7 +100,7 @@ async function checkUpdates(i, o, u) {
100
100
  try {
101
101
  c = await d.getTagSha(o, u, s) ?? e;
102
102
  } catch (t) {
103
- if (isRateLimitError(t)) throw t;
103
+ if (l(t)) throw t;
104
104
  c = e;
105
105
  }
106
106
  }
@@ -115,21 +115,21 @@ async function checkUpdates(i, o, u) {
115
115
  }
116
116
  let g = await d.getAllTags(o, u, 30);
117
117
  if (g.length > 0) {
118
- let a = g.filter((e) => isSemverLike(e.tag)).map((t) => ({
119
- v: semver.valid(normalizeVersion(t.tag)),
118
+ let a = g.filter((e) => t(e.tag)).map((t) => ({
119
+ v: r.valid(e(t.tag)),
120
120
  raw: t
121
121
  })), s;
122
122
  a.length > 0 ? (a.sort((e, t) => {
123
- let n = semver.rcompare(e.v, t.v);
123
+ let n = r.rcompare(e.v, t.v);
124
124
  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;
125
+ let i = +!!/\d+\.\d+/u.test(e.raw.tag);
126
+ return +!!/\d+\.\d+/u.test(t.raw.tag) - i;
127
127
  }), s = a[0].raw) : s = g[0];
128
128
  let c = s.tag, f = s.sha?.length ? s.sha : null;
129
129
  if (!f && c) try {
130
130
  f = await d.getTagSha(o, u, c);
131
131
  } catch (e) {
132
- if (isRateLimitError(e)) throw e;
132
+ if (l(e)) throw e;
133
133
  }
134
134
  return [...n, {
135
135
  currentRefType: p,
@@ -180,7 +180,7 @@ async function checkUpdates(i, o, u) {
180
180
  let y = [];
181
181
  for (let e of m) {
182
182
  let t = v.get(e.name);
183
- t ? y.push(createUpdate(e, {
183
+ t ? y.push(a(e, {
184
184
  publishedAt: t.publishedAt,
185
185
  version: t.version,
186
186
  sha: t.sha
@@ -189,19 +189,19 @@ async function checkUpdates(i, o, u) {
189
189
  skipReason: t.skipReason,
190
190
  status: t.status,
191
191
  style: p
192
- })) : y.push(createUpdate(e, {
192
+ })) : y.push(a(e, {
193
193
  publishedAt: null,
194
194
  version: null,
195
195
  sha: null
196
196
  }, {
197
- currentRefType: deriveCurrentReferenceType(e.version),
197
+ currentRefType: c(e.version),
198
198
  style: p
199
199
  }));
200
200
  }
201
201
  return y;
202
202
  }
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;
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
205
  if (h === "skipped") return {
206
206
  currentRefType: p,
207
207
  currentVersion: u,
@@ -214,15 +214,15 @@ function createUpdate(t, n, i) {
214
214
  action: t,
215
215
  status: h
216
216
  };
217
- if (d && isSha(d)) c ? _ = !compareSha(d, c) : f && (_ = !0);
217
+ if (d && s(d)) c ? _ = !o(d, c) : f && (_ = !0);
218
218
  else if (d && f) {
219
- let e = semver.valid(d), n = semver.valid(f);
219
+ let e = r.valid(d), n = r.valid(f);
220
220
  if (e && n) {
221
- if (_ = semver.lt(e, n), _) {
222
- let t = semver.major(e);
223
- v = semver.major(n) > t;
221
+ if (_ = r.lt(e, n), _) {
222
+ let t = r.major(e);
223
+ v = r.major(n) > t;
224
224
  }
225
- !_ && semver.eq(e, n) && !isSha(t.version) && c && m === "sha" && (_ = !0, v = !1);
225
+ !_ && r.eq(e, n) && !s(t.version) && c && m === "sha" && (_ = !0, v = !1);
226
226
  } else d !== f && (_ = !0);
227
227
  }
228
228
  return {
@@ -238,19 +238,19 @@ function createUpdate(t, n, i) {
238
238
  status: h
239
239
  };
240
240
  }
241
- function compareSha(e, t) {
241
+ function o(e, t) {
242
242
  let n = e.replace(/^v/u, ""), r = t.replace(/^v/u, ""), i = Math.min(n.length, r.length);
243
243
  return i < 7 ? !1 : n.slice(0, Math.max(0, i)).toLowerCase() === r.slice(0, Math.max(0, i)).toLowerCase();
244
244
  }
245
- function isSha(e) {
245
+ function s(e) {
246
246
  if (!e) return !1;
247
247
  let t = e.replace(/^v/u, "");
248
248
  return /^[0-9a-f]{7,40}$/iu.test(t);
249
249
  }
250
- function deriveCurrentReferenceType(e) {
251
- return e ? isSha(e) ? "sha" : isSemverLike(e) ? "tag" : "unknown" : "unknown";
250
+ function c(e) {
251
+ return e ? s(e) ? "sha" : t(e) ? "tag" : "unknown" : "unknown";
252
252
  }
253
- function isRateLimitError(e) {
253
+ function l(e) {
254
254
  return e instanceof Error && e.name === "GitHubRateLimitError";
255
255
  }
256
- 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 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 };
@@ -1,20 +1,20 @@
1
- import { makeRequest } from "./make-request.js";
2
- import { GitHubRateLimitError } from "./internal-rate-limit-error.js";
3
- async function getTagSha(n, r) {
1
+ import { makeRequest as e } from "./make-request.js";
2
+ import { GitHubRateLimitError as t } from "./internal-rate-limit-error.js";
3
+ async function n(n, r) {
4
4
  let { owner: i, repo: a, tag: o } = r, s = o.replace(/^refs\/tags\//u, ""), c = `${i}/${a}#${s}`;
5
5
  if (n.caches.tagSha.has(c)) return n.caches.tagSha.get(c) ?? null;
6
6
  try {
7
- let t = (await makeRequest(n, `/repos/${i}/${a}/git/refs/tags/${s}`)).data, r = t.object.sha, o = t.object.type, l = null;
7
+ let t = (await e(n, `/repos/${i}/${a}/git/refs/tags/${s}`)).data, r = t.object.sha, o = t.object.type, l = null;
8
8
  if (r && o === "tag") try {
9
- l = (await makeRequest(n, `/repos/${i}/${a}/git/tags/${r}`)).data.object.sha ?? null;
9
+ l = (await e(n, `/repos/${i}/${a}/git/tags/${r}`)).data.object.sha ?? null;
10
10
  } catch {
11
11
  l = r;
12
12
  }
13
13
  else r && o === "commit" && (l = r);
14
14
  return n.caches.tagSha.set(c, l), l;
15
15
  } catch (e) {
16
- if (e instanceof Error && e.message.includes("rate limit")) throw new GitHubRateLimitError(n.rateLimitReset);
16
+ if (e instanceof Error && e.message.includes("rate limit")) throw new t(n.rateLimitReset);
17
17
  return n.caches.tagSha.set(c, null), null;
18
18
  }
19
19
  }
20
- export { getTagSha };
20
+ export { n as getTagSha };
@@ -1,7 +1,7 @@
1
- var GitHubRateLimitError = class extends Error {
1
+ var e = class extends Error {
2
2
  constructor(e) {
3
3
  let t = e.toLocaleTimeString();
4
4
  super(`GitHub API rate limit exceeded. Resets at ${t}`), this.name = "GitHubRateLimitError";
5
5
  }
6
6
  };
7
- export { GitHubRateLimitError };
7
+ export { e as GitHubRateLimitError };
@@ -1,5 +1,5 @@
1
- import { updateRateLimitInfo } from "./update-rate-limit-info.js";
2
- async function makeRequest(t, n, r = {}) {
1
+ import { updateRateLimitInfo as e } from "./update-rate-limit-info.js";
2
+ async function t(t, n, r = {}) {
3
3
  let i = {
4
4
  Accept: "application/vnd.github.v3+json",
5
5
  "User-Agent": "actions-up",
@@ -11,7 +11,7 @@ async function makeRequest(t, n, r = {}) {
11
11
  headers: i
12
12
  }), o = {};
13
13
  for (let [e, t] of a.headers.entries()) o[e] = t;
14
- if (updateRateLimitInfo(t, o), !a.ok) {
14
+ if (e(t, o), !a.ok) {
15
15
  let e = /* @__PURE__ */ Error(`GitHub API error: ${a.status} ${a.statusText}`);
16
16
  if (e.status = a.status, a.status === 403) {
17
17
  let t = await a.text();
@@ -24,4 +24,4 @@ async function makeRequest(t, n, r = {}) {
24
24
  data: await a.json()
25
25
  };
26
26
  }
27
- export { makeRequest };
27
+ export { t as makeRequest };
@@ -1,13 +1,13 @@
1
- import { join } from "node:path";
2
- import { execFileSync } from "node:child_process";
3
- import { readFileSync } from "node:fs";
4
- function resolveGitHubTokenSync() {
1
+ import { join as e } from "node:path";
2
+ import { execFileSync as t } from "node:child_process";
3
+ import { readFileSync as n } from "node:fs";
4
+ function r() {
5
5
  let r = process.env.GITHUB_TOKEN;
6
6
  if (r && r.trim() !== "") return r.trim();
7
7
  let i = process.env.GH_TOKEN;
8
8
  if (i && i.trim() !== "") return i.trim();
9
9
  try {
10
- let e = execFileSync("gh", ["auth", "token"], {
10
+ let e = t("gh", ["auth", "token"], {
11
11
  stdio: [
12
12
  "ignore",
13
13
  "pipe",
@@ -19,7 +19,7 @@ function resolveGitHubTokenSync() {
19
19
  if (e) return e;
20
20
  } catch {}
21
21
  try {
22
- let t = readFileSync(join(process.cwd(), ".git", "config"), "utf8"), r = t.match(/^\s*(?:github\.(?:oauth-token|token)|hub\.oauthtoken)\s*=\s*(?<token>\S[^\n\r]*)$/mu)?.groups?.token?.trim();
22
+ let t = n(e(process.cwd(), ".git", "config"), "utf8"), r = t.match(/^\s*(?:github\.(?:oauth-token|token)|hub\.oauthtoken)\s*=\s*(?<token>\S[^\n\r]*)$/mu)?.groups?.token?.trim();
23
23
  if (r) return r;
24
24
  let i = null;
25
25
  for (let e of t.split(/\r?\n/u)) {
@@ -39,4 +39,4 @@ function resolveGitHubTokenSync() {
39
39
  }
40
40
  } catch {}
41
41
  }
42
- export { resolveGitHubTokenSync };
42
+ export { r as resolveGitHubTokenSync };
@@ -1,10 +1,7 @@
1
- function updateRateLimitInfo(e, t) {
1
+ function e(e, t) {
2
2
  let n = t["x-ratelimit-remaining"];
3
3
  n !== void 0 && (e.rateLimitRemaining = typeof n == "string" ? Number.parseInt(n, 10) : n);
4
4
  let r = t["x-ratelimit-reset"];
5
- if (r !== void 0) {
6
- let t = typeof r == "string" ? Number.parseInt(r, 10) : r;
7
- e.rateLimitReset = /* @__PURE__ */ new Date(t * 1e3);
8
- }
5
+ r !== void 0 && (e.rateLimitReset = /* @__PURE__ */ new Date((typeof r == "string" ? Number.parseInt(r, 10) : r) * 1e3));
9
6
  }
10
- export { updateRateLimitInfo };
7
+ export { e as updateRateLimitInfo };
@@ -1,4 +1,4 @@
1
- function hasRange(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "range" in e;
3
3
  }
4
- export { hasRange };
4
+ export { e as hasRange };
@@ -1,4 +1,4 @@
1
- function isNode(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "toJSON" in e && typeof e.toJSON == "function";
3
3
  }
4
- export { isNode };
4
+ export { e as isNode };
@@ -1,4 +1,4 @@
1
- function isPair(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "key" in e && "value" in e;
3
3
  }
4
- export { isPair };
4
+ export { e as isPair };
@@ -1,4 +1,4 @@
1
- function isScalar(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "value" in e;
3
3
  }
4
- export { isScalar };
4
+ export { e as isScalar };
@@ -1,4 +1,4 @@
1
- function isYAMLMap(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "items" in e && Array.isArray(e.items);
3
3
  }
4
- export { isYAMLMap };
4
+ export { e as isYAMLMap };
@@ -1,4 +1,4 @@
1
- function isYAMLSequence(e) {
1
+ function e(e) {
2
2
  return typeof e == "object" && !!e && "items" in e && Array.isArray(e.items);
3
3
  }
4
- export { isYAMLSequence };
4
+ export { e as isYAMLSequence };