actions-up 1.12.0 → 1.13.0
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 +257 -0
- package/dist/cli/build-json-report.js +64 -0
- package/dist/cli/index.d.ts +3 -1
- package/dist/cli/index.js +132 -73
- package/dist/cli/resolve-scan-directories.d.ts +6 -2
- package/dist/cli/validate-cli-options.d.ts +20 -0
- package/dist/cli/validate-cli-options.js +4 -0
- package/dist/core/api/check-updates.js +68 -55
- package/dist/core/api/get-all-releases.d.ts +2 -1
- package/dist/core/api/get-compatible-update.d.ts +15 -5
- package/dist/core/api/get-latest-release.d.ts +3 -3
- package/dist/core/ast/utils/extract-uses-from-steps.d.ts +12 -4
- package/dist/core/constants.d.ts +3 -1
- package/dist/core/fs/find-yaml-files-recursive.js +1 -1
- package/dist/core/interactive/prompt-update-selection.d.ts +3 -1
- package/dist/core/interactive/prompt-update-selection.js +9 -9
- package/dist/core/parsing/parse-action-reference.d.ts +16 -12
- package/dist/core/scan-github-actions.d.ts +4 -1
- package/dist/core/scan-github-actions.js +67 -67
- package/dist/core/versions/get-update-level.d.ts +3 -1
- package/dist/package.js +1 -1
- package/dist/types/action-update.d.ts +30 -10
- package/dist/types/composite-action-runs.d.ts +12 -4
- package/dist/types/composite-action-step.d.ts +24 -8
- package/dist/types/composite-action-structure.d.ts +21 -7
- package/dist/types/github-action.d.ts +27 -9
- package/dist/types/github-client-context.d.ts +24 -8
- package/dist/types/github-client.d.ts +24 -8
- package/dist/types/release-info.d.ts +24 -8
- package/dist/types/scan-result.d.ts +12 -4
- package/dist/types/tag-info.d.ts +15 -5
- package/dist/types/update-mode.d.ts +3 -1
- package/dist/types/workflow-job.d.ts +27 -9
- package/dist/types/workflow-step.d.ts +21 -7
- package/dist/types/workflow-structure.d.ts +15 -5
- package/package.json +3 -8
- package/readme.md +94 -71
|
@@ -2,17 +2,17 @@ import { ACTIONS_DIRECTORY, GITHUB_DIRECTORY, WORKFLOWS_DIRECTORY } from "./cons
|
|
|
2
2
|
import { isYamlFile } from "./fs/is-yaml-file.js";
|
|
3
3
|
import { scanWorkflowFile } from "./scan-workflow-file.js";
|
|
4
4
|
import { scanActionFile } from "./scan-action-file.js";
|
|
5
|
-
import { readFile, readdir, stat } from "node:fs/promises";
|
|
6
5
|
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
7
|
-
|
|
6
|
+
import { readFile, readdir, stat } from "node:fs/promises";
|
|
7
|
+
async function scanGitHubActions(p = process.cwd(), m = GITHUB_DIRECTORY) {
|
|
8
8
|
let h = {
|
|
9
9
|
compositeActions: /* @__PURE__ */ new Map(),
|
|
10
10
|
workflows: /* @__PURE__ */ new Map(),
|
|
11
11
|
actions: []
|
|
12
|
-
}, g = resolve(
|
|
13
|
-
function _(e,
|
|
14
|
-
let
|
|
15
|
-
return
|
|
12
|
+
}, g = resolve(p);
|
|
13
|
+
function _(e, a) {
|
|
14
|
+
let o = relative(e, a);
|
|
15
|
+
return o !== "" && !o.startsWith("..") && !isAbsolute(o);
|
|
16
16
|
}
|
|
17
17
|
let v = join(g, m);
|
|
18
18
|
function y(e) {
|
|
@@ -20,8 +20,8 @@ async function scanGitHubActions(d = process.cwd(), m = GITHUB_DIRECTORY) {
|
|
|
20
20
|
}
|
|
21
21
|
async function b(e) {
|
|
22
22
|
try {
|
|
23
|
-
let
|
|
24
|
-
return typeof
|
|
23
|
+
let a = await stat(e);
|
|
24
|
+
return typeof a.isFile == "function" ? a.isFile() : !1;
|
|
25
25
|
} catch {
|
|
26
26
|
return !1;
|
|
27
27
|
}
|
|
@@ -30,13 +30,13 @@ async function scanGitHubActions(d = process.cwd(), m = GITHUB_DIRECTORY) {
|
|
|
30
30
|
try {
|
|
31
31
|
if ((await stat(x)).isDirectory()) {
|
|
32
32
|
let e = (await readdir(x)).filter((e) => y(e) ? isYamlFile(e) : !1).map(async (e) => {
|
|
33
|
-
let
|
|
33
|
+
let a = join(x, e);
|
|
34
34
|
try {
|
|
35
|
-
let
|
|
35
|
+
let s = await scanWorkflowFile(a);
|
|
36
36
|
return {
|
|
37
37
|
path: `${m}/${WORKFLOWS_DIRECTORY}/${e}`,
|
|
38
38
|
success: !0,
|
|
39
|
-
actions:
|
|
39
|
+
actions: s
|
|
40
40
|
};
|
|
41
41
|
} catch {
|
|
42
42
|
return {
|
|
@@ -45,111 +45,111 @@ async function scanGitHubActions(d = process.cwd(), m = GITHUB_DIRECTORY) {
|
|
|
45
45
|
actions: []
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
}),
|
|
49
|
-
for (let e of
|
|
48
|
+
}), a = await Promise.all(e);
|
|
49
|
+
for (let e of a) 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 = join(g, "action.yml"),
|
|
53
|
+
let e = join(g, "action.yml"), a = join(g, "action.yaml"), o = null, s = [];
|
|
54
54
|
if (await b(e)) try {
|
|
55
|
-
|
|
55
|
+
s = await scanActionFile(e), o = e;
|
|
56
56
|
} catch {
|
|
57
|
-
|
|
57
|
+
o = null;
|
|
58
58
|
}
|
|
59
|
-
if (!
|
|
60
|
-
|
|
59
|
+
if (!o && await b(a)) try {
|
|
60
|
+
s = await scanActionFile(a), o = a;
|
|
61
61
|
} catch {
|
|
62
|
-
|
|
62
|
+
o = null;
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
65
|
-
let e = relative(g,
|
|
66
|
-
h.compositeActions.set(e, e),
|
|
64
|
+
if (o) {
|
|
65
|
+
let e = relative(g, o);
|
|
66
|
+
h.compositeActions.set(e, e), s.length > 0 && h.actions.push(...s);
|
|
67
67
|
}
|
|
68
68
|
} catch {}
|
|
69
69
|
let S = join(v, ACTIONS_DIRECTORY);
|
|
70
70
|
try {
|
|
71
71
|
if ((await stat(S)).isDirectory()) {
|
|
72
|
-
let
|
|
73
|
-
if (!y(
|
|
74
|
-
let
|
|
72
|
+
let a = (await readdir(S)).map(async (a) => {
|
|
73
|
+
if (!y(a)) return null;
|
|
74
|
+
let o = join(S, a);
|
|
75
75
|
try {
|
|
76
|
-
if (!(await stat(
|
|
77
|
-
let
|
|
76
|
+
if (!(await stat(o)).isDirectory()) return null;
|
|
77
|
+
let s = join(o, "action.yml"), c = [];
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
c = await scanActionFile(s);
|
|
80
80
|
} catch {
|
|
81
81
|
try {
|
|
82
|
-
|
|
82
|
+
s = join(o, "action.yaml"), c = await scanActionFile(s);
|
|
83
83
|
} catch {
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
return {
|
|
88
|
-
path: `${m}/${ACTIONS_DIRECTORY}/${
|
|
89
|
-
name:
|
|
90
|
-
actions:
|
|
88
|
+
path: `${m}/${ACTIONS_DIRECTORY}/${a}`,
|
|
89
|
+
name: a,
|
|
90
|
+
actions: c
|
|
91
91
|
};
|
|
92
92
|
} catch {
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
95
|
-
}),
|
|
96
|
-
for (let e of
|
|
95
|
+
}), o = await Promise.all(a);
|
|
96
|
+
for (let e of o) e && (h.compositeActions.set(e.name, e.path), h.actions.push(...e.actions));
|
|
97
97
|
}
|
|
98
98
|
} catch {}
|
|
99
99
|
try {
|
|
100
100
|
let e = await getCurrentRepoSlug(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 a = /* @__PURE__ */ new Set(), o = [];
|
|
104
|
+
for (let s of h.actions) {
|
|
105
|
+
if (s.type !== "external") continue;
|
|
106
|
+
let c = s.name.split("/");
|
|
107
|
+
if (c.length < 3 || `${c[0]}/${c[1]}` !== e) continue;
|
|
108
|
+
let l = join(g, ...c.slice(2));
|
|
109
|
+
_(g, l) && (a.has(l) || (a.add(l), o.push(l)));
|
|
110
110
|
}
|
|
111
|
-
async function
|
|
112
|
-
if (
|
|
113
|
-
let
|
|
111
|
+
async function s() {
|
|
112
|
+
if (o.length === 0) return;
|
|
113
|
+
let c = o.splice(0), u = await Promise.all(c.map(async (o) => {
|
|
114
114
|
try {
|
|
115
|
-
let
|
|
115
|
+
let s = join(o, "action.yml"), c = join(o, "action.yaml"), u = s;
|
|
116
116
|
try {
|
|
117
|
-
if (!(await stat(
|
|
117
|
+
if (!(await stat(s)).isFile()) throw Error("not a file");
|
|
118
118
|
} catch {
|
|
119
|
-
if (!(await stat(
|
|
120
|
-
|
|
119
|
+
if (!(await stat(c)).isFile()) throw Error("not a file");
|
|
120
|
+
u = c;
|
|
121
121
|
}
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
let
|
|
125
|
-
for (let
|
|
126
|
-
if (
|
|
127
|
-
let
|
|
128
|
-
if (
|
|
129
|
-
let
|
|
130
|
-
_(g,
|
|
122
|
+
let d = await scanActionFile(u);
|
|
123
|
+
d.length > 0 && h.actions.push(...d);
|
|
124
|
+
let f = [];
|
|
125
|
+
for (let o of d) {
|
|
126
|
+
if (o.type !== "external") continue;
|
|
127
|
+
let s = o.name.split("/");
|
|
128
|
+
if (s.length < 3 || `${s[0]}/${s[1]}` !== e) continue;
|
|
129
|
+
let c = join(g, ...s.slice(2));
|
|
130
|
+
_(g, c) && (a.has(c) || (a.add(c), f.push(c)));
|
|
131
131
|
}
|
|
132
|
-
return
|
|
132
|
+
return f;
|
|
133
133
|
} catch {
|
|
134
134
|
return [];
|
|
135
135
|
}
|
|
136
136
|
}));
|
|
137
|
-
for (let e of
|
|
138
|
-
await
|
|
137
|
+
for (let e of u) for (let a of e) o.push(a);
|
|
138
|
+
await s();
|
|
139
139
|
}
|
|
140
|
-
await
|
|
140
|
+
await s();
|
|
141
141
|
}
|
|
142
142
|
} catch {}
|
|
143
143
|
return h;
|
|
144
144
|
}
|
|
145
145
|
async function getCurrentRepoSlug(e) {
|
|
146
|
-
let
|
|
147
|
-
if (
|
|
146
|
+
let a = process.env.GITHUB_REPOSITORY;
|
|
147
|
+
if (a && /^[^\s/]+\/[^\s/]+$/u.test(a)) return a;
|
|
148
148
|
try {
|
|
149
|
-
let
|
|
150
|
-
if (
|
|
151
|
-
let
|
|
152
|
-
if (
|
|
149
|
+
let a = await readFile(join(e, ".git", "config"), "utf8"), o = a.match(/\[remote "origin"\][\s\S]*?url\s*=\s*(?<url>.+)/u)?.groups?.url?.trim();
|
|
150
|
+
if (o ||= a.match(/url\s*=\s*(?<url>.+)/u)?.groups?.url?.trim(), !o) return null;
|
|
151
|
+
let s = o.match(/github\.com[/:](?<owner>[^/]+)\/(?<repo>[^./]+)(?:\.git)?$/u);
|
|
152
|
+
if (s?.groups) return `${s.groups.owner}/${s.groups.repo}`;
|
|
153
153
|
} catch {}
|
|
154
154
|
return null;
|
|
155
155
|
}
|
package/dist/package.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "1.
|
|
1
|
+
const version = "1.13.0";
|
|
2
2
|
export { version };
|
|
@@ -1,30 +1,50 @@
|
|
|
1
1
|
import { GitHubAction } from './github-action';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Update information for a GitHub Action.
|
|
4
|
+
*/
|
|
3
5
|
export interface ActionUpdate {
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Reason for skipping the update check.
|
|
8
|
+
*/
|
|
5
9
|
skipReason?: 'unknown' | 'branch'
|
|
6
10
|
|
|
7
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Current version string.
|
|
13
|
+
*/
|
|
8
14
|
currentVersion: string | null
|
|
9
15
|
|
|
10
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Latest available version.
|
|
18
|
+
*/
|
|
11
19
|
latestVersion: string | null
|
|
12
20
|
|
|
13
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Status of the check for this action.
|
|
23
|
+
*/
|
|
14
24
|
status?: 'skipped' | 'ok'
|
|
15
25
|
|
|
16
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* SHA hash of the latest version.
|
|
28
|
+
*/
|
|
17
29
|
latestSha: string | null
|
|
18
30
|
|
|
19
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Publication date of the latest version (null if unknown).
|
|
33
|
+
*/
|
|
20
34
|
publishedAt: Date | null
|
|
21
35
|
|
|
22
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* The original action from scanning.
|
|
38
|
+
*/
|
|
23
39
|
action: GitHubAction
|
|
24
40
|
|
|
25
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Whether this is a major version change.
|
|
43
|
+
*/
|
|
26
44
|
isBreaking: boolean
|
|
27
45
|
|
|
28
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Whether an update is available.
|
|
48
|
+
*/
|
|
29
49
|
hasUpdate: boolean
|
|
30
50
|
}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { CompositeActionStep } from './composite-action-step';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Represents the runs configuration for a composite action.
|
|
4
|
+
*/
|
|
3
5
|
export interface CompositeActionRuns {
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Array of steps to execute.
|
|
8
|
+
*/
|
|
5
9
|
steps?: CompositeActionStep[]
|
|
6
10
|
|
|
7
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Allow additional properties.
|
|
13
|
+
*/
|
|
8
14
|
[key: string]: unknown
|
|
9
15
|
|
|
10
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Must be 'composite' for composite actions.
|
|
18
|
+
*/
|
|
11
19
|
using?: string
|
|
12
20
|
}
|
|
@@ -1,23 +1,39 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Represents a step in a composite GitHub Action.
|
|
3
|
+
*/
|
|
2
4
|
export interface CompositeActionStep {
|
|
3
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Environment variables for this step.
|
|
7
|
+
*/
|
|
4
8
|
env?: Record<string, unknown>
|
|
5
9
|
|
|
6
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Working directory for the step.
|
|
12
|
+
*/
|
|
7
13
|
'working-directory'?: string
|
|
8
14
|
|
|
9
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Allow additional properties.
|
|
17
|
+
*/
|
|
10
18
|
[key: string]: unknown
|
|
11
19
|
|
|
12
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Shell to use for the run command.
|
|
22
|
+
*/
|
|
13
23
|
shell?: string
|
|
14
24
|
|
|
15
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Action to use for this step.
|
|
27
|
+
*/
|
|
16
28
|
uses?: string
|
|
17
29
|
|
|
18
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Display name for this step.
|
|
32
|
+
*/
|
|
19
33
|
name?: string
|
|
20
34
|
|
|
21
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Shell command to run for this step.
|
|
37
|
+
*/
|
|
22
38
|
run?: string
|
|
23
39
|
}
|
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
import { CompositeActionRuns } from './composite-action-runs';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Represents the structure of a composite GitHub Action file.
|
|
4
|
+
*/
|
|
3
5
|
export interface CompositeActionStructure {
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Output values from the action.
|
|
8
|
+
*/
|
|
5
9
|
outputs?: Record<string, unknown>
|
|
6
10
|
|
|
7
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Input parameters for the action.
|
|
13
|
+
*/
|
|
8
14
|
inputs?: Record<string, unknown>
|
|
9
15
|
|
|
10
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Runs configuration for composite actions.
|
|
18
|
+
*/
|
|
11
19
|
runs?: CompositeActionRuns
|
|
12
20
|
|
|
13
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Allow additional properties.
|
|
23
|
+
*/
|
|
14
24
|
[key: string]: unknown
|
|
15
25
|
|
|
16
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Description of what the action does.
|
|
28
|
+
*/
|
|
17
29
|
description?: string
|
|
18
30
|
|
|
19
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Display name of the action.
|
|
33
|
+
*/
|
|
20
34
|
name?: string
|
|
21
35
|
}
|
|
@@ -1,26 +1,44 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Represents a GitHub Action used in workflows or composite actions.
|
|
3
|
+
*/
|
|
2
4
|
export interface GitHubAction {
|
|
3
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Type of the GitHub Action.
|
|
7
|
+
*/
|
|
4
8
|
type: 'reusable-workflow' | 'composite' | 'external' | 'docker' | 'local'
|
|
5
9
|
|
|
6
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Version or tag of the action (e.g., 'v1', 'main', commit SHA).
|
|
12
|
+
*/
|
|
7
13
|
version?: string | null
|
|
8
14
|
|
|
9
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Line number where the action is used in the file.
|
|
17
|
+
*/
|
|
10
18
|
line?: number
|
|
11
19
|
|
|
12
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Path to the file where this action is used.
|
|
22
|
+
*/
|
|
13
23
|
file?: string
|
|
14
24
|
|
|
15
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Original `uses` string from workflow, if available.
|
|
27
|
+
*/
|
|
16
28
|
uses?: string
|
|
17
29
|
|
|
18
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Name of the job where this action is used (for workflows).
|
|
32
|
+
*/
|
|
19
33
|
job?: string
|
|
20
34
|
|
|
21
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Full name of the action (e.g., 'actions/checkout').
|
|
37
|
+
*/
|
|
22
38
|
name: string
|
|
23
39
|
|
|
24
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Original `ref` string from workflow, if available.
|
|
42
|
+
*/
|
|
25
43
|
ref?: string
|
|
26
44
|
}
|
|
@@ -6,27 +6,43 @@ import { TagInfo } from './tag-info';
|
|
|
6
6
|
* number of API requests during a single run.
|
|
7
7
|
*/
|
|
8
8
|
export interface GitHubClientContext {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Lightweight caches keyed by owner/repo (+ extra payload).
|
|
11
|
+
*/
|
|
10
12
|
caches: {
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Cache of reference type detections (branch/tag/null).
|
|
15
|
+
*/
|
|
12
16
|
refType: Map<string, 'branch' | 'tag' | null>
|
|
13
17
|
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Cache of resolved tag metadata (message/date/SHA).
|
|
20
|
+
*/
|
|
15
21
|
tagInfo: Map<string, TagInfo | null>
|
|
16
22
|
|
|
17
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Cache of resolved tag commit SHAs.
|
|
25
|
+
*/
|
|
18
26
|
tagSha: Map<string, string | null>
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Remaining requests available per current rate-limit window.
|
|
31
|
+
*/
|
|
22
32
|
rateLimitRemaining: number
|
|
23
33
|
|
|
24
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* GitHub token, if available.
|
|
36
|
+
*/
|
|
25
37
|
token: undefined | string
|
|
26
38
|
|
|
27
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Scheduled time when rate limit resets.
|
|
41
|
+
*/
|
|
28
42
|
rateLimitReset: Date
|
|
29
43
|
|
|
30
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* GitHub REST API base URL.
|
|
46
|
+
*/
|
|
31
47
|
baseUrl: string
|
|
32
48
|
}
|
|
@@ -8,35 +8,51 @@ import { TagInfo } from './tag-info';
|
|
|
8
8
|
* normalized, serializable data structures.
|
|
9
9
|
*/
|
|
10
10
|
export interface GitHubClient {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Detect whether a reference is a tag or a branch (or unknown).
|
|
13
|
+
*/
|
|
12
14
|
getRefType(
|
|
13
15
|
owner: string,
|
|
14
16
|
repo: string,
|
|
15
17
|
reference: string,
|
|
16
18
|
): Promise<'branch' | 'tag' | null>
|
|
17
19
|
|
|
18
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* List releases with minimal enrichment.
|
|
22
|
+
*/
|
|
19
23
|
getAllReleases(
|
|
20
24
|
owner: string,
|
|
21
25
|
repo: string,
|
|
22
26
|
limit?: number,
|
|
23
27
|
): Promise<ReleaseInfo[]>
|
|
24
28
|
|
|
25
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Fetch tag metadata (message/date) and the resolved commit SHA.
|
|
31
|
+
*/
|
|
26
32
|
getTagInfo(owner: string, repo: string, tag: string): Promise<TagInfo | null>
|
|
27
33
|
|
|
28
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Resolve commit SHA for a tag without fetching commit data.
|
|
36
|
+
*/
|
|
29
37
|
getTagSha(owner: string, repo: string, tag: string): Promise<string | null>
|
|
30
38
|
|
|
31
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* List repository tags (name + commit SHA).
|
|
41
|
+
*/
|
|
32
42
|
getAllTags(owner: string, repo: string, limit?: number): Promise<TagInfo[]>
|
|
33
43
|
|
|
34
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Fetch the latest release or null when no latest release exists.
|
|
46
|
+
*/
|
|
35
47
|
getLatestRelease(owner: string, repo: string): Promise<ReleaseInfo | null>
|
|
36
48
|
|
|
37
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Current rate limit snapshot.
|
|
51
|
+
*/
|
|
38
52
|
getRateLimitStatus(): { remaining: number; resetAt: Date }
|
|
39
53
|
|
|
40
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* True when remaining requests are below a threshold.
|
|
56
|
+
*/
|
|
41
57
|
shouldWaitForRateLimit(threshold?: number): boolean
|
|
42
58
|
}
|
|
@@ -1,23 +1,39 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Normalized release information used across the tool.
|
|
3
|
+
*/
|
|
2
4
|
export interface ReleaseInfo {
|
|
3
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Release description (body) or null when absent.
|
|
7
|
+
*/
|
|
4
8
|
description: string | null
|
|
5
9
|
|
|
6
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* True when the release is marked as prerelease.
|
|
12
|
+
*/
|
|
7
13
|
isPrerelease: boolean
|
|
8
14
|
|
|
9
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Commit SHA associated with the release tag when known (may be provisional).
|
|
17
|
+
*/
|
|
10
18
|
sha: string | null
|
|
11
19
|
|
|
12
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Publication date of the release.
|
|
22
|
+
*/
|
|
13
23
|
publishedAt: Date
|
|
14
24
|
|
|
15
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Tag name (e.g. V1.2.3).
|
|
27
|
+
*/
|
|
16
28
|
version: string
|
|
17
29
|
|
|
18
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Release name or tag name when name is not provided.
|
|
32
|
+
*/
|
|
19
33
|
name: string
|
|
20
34
|
|
|
21
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* HTML URL of the release page.
|
|
37
|
+
*/
|
|
22
38
|
url: string
|
|
23
39
|
}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { GitHubAction } from './github-action';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Result of scanning a repository for GitHub Actions usage.
|
|
4
|
+
*/
|
|
3
5
|
export interface ScanResult {
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Map of workflow files to their used GitHub Actions.
|
|
8
|
+
*/
|
|
5
9
|
workflows: Map<string, GitHubAction[]>
|
|
6
10
|
|
|
7
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Map of composite action names to their file paths.
|
|
13
|
+
*/
|
|
8
14
|
compositeActions: Map<string, string>
|
|
9
15
|
|
|
10
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* List of all unique GitHub Actions found in the repository.
|
|
18
|
+
*/
|
|
11
19
|
actions: GitHubAction[]
|
|
12
20
|
}
|