-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDependencies.ts
More file actions
113 lines (101 loc) · 2.42 KB
/
Copy pathDependencies.ts
File metadata and controls
113 lines (101 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// abstracting external dependencies
export interface Dependencies {
owner: string;
repo: string;
githubToken: string;
adminToken: string;
branch: string;
skipPR: boolean;
isArchived: boolean;
octokit: OctokitClient;
adminOctokit: OctokitClient | null;
exec: (command: string) => Promise<{ stdout: string; stderr: string }>;
readFile: (filepath: string) => Promise<string>;
log: Logger;
setOutput: (name: string, value: unknown) => void;
setFailed: (message: string) => void;
}
export interface Logger {
info: (message: string) => void;
error: (message: string) => void;
warning: (message: string) => void;
debug: (message: string) => void;
}
export interface OctokitClient {
rest: {
repos: {
get: (params: { owner: string; repo: string }) => Promise<RepoResponse>;
getLatestRelease: (params: {
owner: string;
repo: string;
}) => Promise<ReleaseResponse>;
listLanguages: (params: {
owner: string;
repo: string;
}) => Promise<LanguagesResponse>;
getContent: (params: {
owner: string;
repo: string;
path: string;
ref: string;
}) => Promise<ContentResponse>;
createOrUpdateFileContents: (params: {
owner: string;
repo: string;
path: string;
message: string;
content: string;
branch: string;
sha?: string;
}) => Promise<CommitResponse>;
};
};
createPullRequest: (params: {
owner: string;
repo: string;
title: string;
body: string;
base: string;
head: string;
labels: string[];
changes: Array<{
files: Record<string, string>;
commit: string;
}>;
}) => Promise<{ data: { html_url: string } } | null>;
}
export interface RepoResponse {
data: {
name: string;
description: string | null;
html_url: string;
private: boolean;
forks_count: number;
topics?: string[];
created_at: string;
updated_at: string;
default_branch: string;
fork?: boolean;
parent?: {
full_name: string;
html_url: string;
} | null;
};
}
export interface LanguagesResponse {
data: Record<string, number>;
}
export interface ReleaseResponse {
data: {
tag_name: string;
name: string | null;
};
}
export interface ContentResponse {
data: { sha?: string } | Array<unknown>;
}
export interface CommitResponse {
data: {
commit: { sha: string };
};
}