Skip to content

Commit bab6e95

Browse files
fix(ports): fetch all github releases (#123)
* fix(ports): fetch all github releases * fix: lint & typing * fix: pre-commit
1 parent 5589652 commit bab6e95

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

.ghjk/lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@
582582
}
583583
]
584584
},
585-
"bciqlzb7cvow3nmr4kwrejkgeh7f4xi3pvh4xiycgond3n5utuculpqi": {
585+
"bciqntdd4tf4hjde4tjedzhrmpwksarvwuamiljjig2fqco26oiz5gsa": {
586586
"provides": [
587587
{
588588
"ty": "posix.envVar",
@@ -592,7 +592,7 @@
592592
{
593593
"ty": "posix.envVar",
594594
"key": "RUSTY_V8_MIRROR",
595-
"val": "/home/yohe/ghjk/.dev/rusty_v8"
595+
"val": "/home/luckasranarison/Projects/ghjk/.dev/rusty_v8"
596596
},
597597
{
598598
"ty": "ghjk.ports.InstallSetRef",
@@ -606,7 +606,7 @@
606606
"main": "bciqenvipb7pm4gge77liqnjhvdv7nhckd6kqjg3bhc3pc6e4g6o2zwa",
607607
"_rust": "bciqm23m6kl7m2mdbjmcjoleysme4gwtkzeeqrbyrpydpm3fvx3bn25a",
608608
"ci": "bciqm23m6kl7m2mdbjmcjoleysme4gwtkzeeqrbyrpydpm3fvx3bn25a",
609-
"dev": "bciqlzb7cvow3nmr4kwrejkgeh7f4xi3pvh4xiycgond3n5utuculpqi"
609+
"dev": "bciqntdd4tf4hjde4tjedzhrmpwksarvwuamiljjig2fqco26oiz5gsa"
610610
}
611611
}
612612
}

src/deno_utils/worker.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ function denoFsReadShim() {
8282
}
8383
{
8484
const old = Deno.readDirSync;
85-
const replace: typeof old = (
86-
path: string | URL,
87-
) => {
85+
const replace = (path: string | URL) => {
8886
let parent = typeof path === "string" ? path : path.pathname;
8987
readFiles.add(parent);
9088
if (!parent.endsWith("/")) {

src/sys_deno/ports/ghrel.ts

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,27 +70,38 @@ export abstract class GithubReleasePort extends PortBase {
7070
count: 10,
7171
delay: $.exponentialBackoff(1000),
7272
action: async () =>
73-
await $.request(
73+
(await $.request(
7474
`https://api.github.com/repos/${this.repoOwner}/${this.repoName}/releases/latest`,
7575
)
7676
.header(ghHeaders(args.config))
77-
.json() as { tag_name: string },
77+
.json()) as { tag_name: string },
7878
});
7979

8080
return metadata.tag_name;
8181
}
8282

8383
async listAll(args: ListAllArgs) {
84-
const metadata = await $.withRetries({
85-
count: 10,
86-
delay: $.exponentialBackoff(1000),
87-
action: async () =>
88-
await $.request(
89-
`https://api.github.com/repos/${this.repoOwner}/${this.repoName}/releases`,
90-
)
91-
.header(ghHeaders(args.config))
92-
.json() as [{ tag_name: string }],
93-
});
84+
const metadata: { tag_name: string }[] = [];
85+
86+
for (let page = 1;; page++) {
87+
// deno-lint-ignore no-await-in-loop
88+
const pageMetadata = await $.withRetries({
89+
count: 10,
90+
delay: $.exponentialBackoff(1000),
91+
action: async () =>
92+
(await $.request(
93+
`https://api.github.com/repos/${this.repoOwner}/${this.repoName}/releases?per_page=100&page=${page}`,
94+
)
95+
.header(ghHeaders(args.config))
96+
.json()) as { tag_name: string }[],
97+
});
98+
99+
if (!pageMetadata || !pageMetadata.length) {
100+
break;
101+
}
102+
103+
metadata.push(...pageMetadata);
104+
}
94105

95106
return metadata.map((rel) => rel.tag_name).reverse();
96107
}

0 commit comments

Comments
 (0)