-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.ts
More file actions
44 lines (38 loc) · 903 Bytes
/
github.ts
File metadata and controls
44 lines (38 loc) · 903 Bytes
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
interface Data {
id: number;
name: string;
url: string;
package_html_url: string;
created_at: string;
updated_at: string;
html_url: string;
metadata: Metadata;
}
interface Metadata {
package_type: string;
container: Container;
}
interface Container {
tags: string[];
}
export async function getGCRVersion() {
let page = 1;
const arr: string[] = [];
while (true) {
const resp = await fetch(
`https://api.github.com/orgs/x2ox/packages/container/gitlab-db/versions?active=active&per_page=100&page=${page}`,
{
headers: { Authorization: `token ${Deno.env.get("GITHUB_TOKEN")}` },
},
);
const data = await resp.json() as Data[];
if (data.length === 0) break;
data.forEach((v) => {
if (v.metadata.container.tags.length !== 0) {
arr.push(...v.metadata.container.tags);
}
});
page++;
}
return arr;
}