-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
151 lines (132 loc) · 2.99 KB
/
Copy pathindex.d.ts
File metadata and controls
151 lines (132 loc) · 2.99 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
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
149
150
151
export type GitHubResourceKind =
| "repo"
| "blob"
| "tree"
| "issue"
| "pull"
| "commit"
| "release"
| "releases"
| "latest-release"
| "compare"
| "tags"
| "branches"
| "discussions"
| "discussion"
| "actions"
| "workflow-run";
export interface BaseGitHubUrlInfo {
owner: string;
repo: string;
domain: "github.com";
type: "github";
kind: GitHubResourceKind;
committish: string | null;
repoUrl: string;
browseUrl: string;
apiUrl: string;
httpsUrl: string;
sshUrl: string;
}
export interface GitHubRepoInfo extends BaseGitHubUrlInfo {
kind: "repo";
}
export interface GitHubBlobInfo extends BaseGitHubUrlInfo {
kind: "blob";
committish: string;
ref: string;
path: string;
rawUrl: string;
}
export interface GitHubTreeInfo extends BaseGitHubUrlInfo {
kind: "tree";
committish: string;
ref: string;
path: string;
rawUrl: null;
}
export interface GitHubIssueInfo extends BaseGitHubUrlInfo {
kind: "issue";
committish: null;
number: number;
}
export interface GitHubPullInfo extends BaseGitHubUrlInfo {
kind: "pull";
committish: null;
number: number;
}
export interface GitHubCommitInfo extends BaseGitHubUrlInfo {
kind: "commit";
committish: string;
sha: string;
}
export interface GitHubReleaseInfo extends BaseGitHubUrlInfo {
kind: "release";
committish: string;
tag: string;
}
export interface GitHubReleasesInfo extends BaseGitHubUrlInfo {
kind: "releases";
committish: null;
collection: "releases";
}
export interface GitHubLatestReleaseInfo extends BaseGitHubUrlInfo {
kind: "latest-release";
committish: null;
selector: "latest";
}
export interface GitHubCompareInfo extends BaseGitHubUrlInfo {
kind: "compare";
committish: null;
range: string;
baseRef: string;
headRef: string;
}
export interface GitHubTagsInfo extends BaseGitHubUrlInfo {
kind: "tags";
committish: null;
collection: "tags";
}
export interface GitHubBranchesInfo extends BaseGitHubUrlInfo {
kind: "branches";
committish: null;
collection: "branches";
}
export interface GitHubDiscussionsInfo extends BaseGitHubUrlInfo {
kind: "discussions";
committish: null;
collection: "discussions";
}
export interface GitHubDiscussionInfo extends BaseGitHubUrlInfo {
kind: "discussion";
committish: null;
number: number;
}
export interface GitHubActionsInfo extends BaseGitHubUrlInfo {
kind: "actions";
committish: null;
collection: "actions";
}
export interface GitHubWorkflowRunInfo extends BaseGitHubUrlInfo {
kind: "workflow-run";
committish: null;
runId: number;
}
export type ParsedGitHubUrl =
| GitHubRepoInfo
| GitHubBlobInfo
| GitHubTreeInfo
| GitHubIssueInfo
| GitHubPullInfo
| GitHubCommitInfo
| GitHubReleaseInfo
| GitHubReleasesInfo
| GitHubLatestReleaseInfo
| GitHubCompareInfo
| GitHubTagsInfo
| GitHubBranchesInfo
| GitHubDiscussionsInfo
| GitHubDiscussionInfo
| GitHubActionsInfo
| GitHubWorkflowRunInfo;
export function parseGitHubUrl(url: string): ParsedGitHubUrl | null;