-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
types.ts
148 lines (134 loc) · 3.07 KB
/
types.ts
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import type { Pr, PrBodyStruct } from '../types';
// https://developer.github.com/v3/repos/statuses
// https://developer.github.com/v3/checks/runs/
export type CombinedBranchState = 'failure' | 'pending' | 'success';
export type BranchState = 'failure' | 'pending' | 'success' | 'error';
export interface GhBranchStatus {
context: string;
state: BranchState;
}
export interface CombinedBranchStatus {
state: CombinedBranchState;
statuses: GhBranchStatus[];
}
export interface Comment {
id: number;
body: string;
}
export interface GhRestPr {
head: {
ref: string;
sha: string;
repo: {
full_name: string;
pushed_at?: string;
};
};
base: {
repo: {
pushed_at?: string;
};
};
mergeable_state: string;
number: number;
title: string;
body?: string;
bodyStruct?: PrBodyStruct;
state: string;
merged_at?: string;
created_at: string;
closed_at?: string;
updated_at: string;
user?: { login?: string };
node_id: string;
assignee?: { login?: string };
assignees?: { login?: string }[];
requested_reviewers?: { login?: string }[];
labels?: { name: string }[];
_links?: unknown;
}
export interface GhGraphQlPr {
number: number;
title: string;
body?: string;
state?: string;
headRefName: string;
baseRefName?: string;
labels?: { nodes?: { name: string }[] };
assignees?: { totalCount: number };
reviewRequests?: { totalCount: number };
comments?: {
nodes?: {
databaseId: number;
body: string;
}[];
};
}
export interface UserDetails {
username: string;
name: string;
}
export interface PlatformConfig {
hostType: string;
endpoint: string;
isGhe?: boolean;
gheVersion?: string | null;
isGHApp?: boolean;
existingRepos?: string[];
userDetails?: UserDetails;
userEmail?: string | null;
}
export interface LocalRepoConfig {
repositoryName: string;
pushProtection: boolean;
prReviewsRequired: boolean;
repoForceRebase?: boolean;
parentRepo: string | null;
forkMode?: boolean;
forkToken?: string;
prList: Pr[] | null;
issueList: any[] | null;
mergeMethod: 'rebase' | 'squash' | 'merge';
defaultBranch: string;
repositoryOwner: string;
repository: string | null;
renovateUsername: string | undefined;
productLinks: any;
ignorePrAuthor: boolean;
autoMergeAllowed: boolean;
hasIssuesEnabled: boolean;
}
export type BranchProtection = any;
export interface GhRepo {
id: string;
isFork: boolean;
isArchived: boolean;
nameWithOwner: string;
autoMergeAllowed: boolean;
hasIssuesEnabled: boolean;
mergeCommitAllowed: boolean;
rebaseMergeAllowed: boolean;
squashMergeAllowed: boolean;
defaultBranchRef: {
name: string;
target: {
oid: string;
};
};
}
export interface GhAutomergeResponse {
enablePullRequestAutoMerge: {
pullRequest: { number: number };
};
}
export interface ApiPageItem {
number: number;
updated_at: string;
}
/**
* Mutable object designed to be used in the repository cache
*/
export interface ApiPageCache<T extends ApiPageItem = ApiPageItem> {
items: Record<number, T>;
lastModified?: string;
}