Skip to content

Commit 896c6bd

Browse files
committed
fix: 🐛 fetch more versions
fetch up to 100 versions (currently, Obsidian API limits how much we can access response headers and therefore we can currently not page. CLOSES #107
1 parent bf0c4ef commit 896c6bd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/features/githubUtils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ export const isPrivateRepo = async (repository: string, debugLogging = true, acc
4646
* @returns array of version strings, or null if error
4747
*/
4848
export const fetchReleaseVersions = async (repository: string, debugLogging = true, accessToken = ""): Promise<ReleaseVersion[] | null> => {
49-
const URL = `https://api.github.com/repos/${repository}/releases`;
49+
const apiUrl = `https://api.github.com/repos/${repository}/releases`;
5050
try {
5151
const response = await gitHubRequest({
52-
url: URL,
52+
url: `${apiUrl}?per_page=100`,
5353
headers: accessToken
5454
? {
5555
Authorization: `Token ${accessToken}`,
@@ -67,7 +67,7 @@ export const fetchReleaseVersions = async (repository: string, debugLogging = tr
6767
throw error; // Rethrow rate limit errors
6868
}
6969

70-
if (debugLogging) console.log("error in fetchReleaseVersions", URL, error);
70+
if (debugLogging) console.log("error in fetchReleaseVersions", apiUrl, error);
7171
return null;
7272
}
7373
};
@@ -288,7 +288,7 @@ export const grabReleaseFromRepository = async (
288288
}
289289

290290
const response = await gitHubRequest({
291-
url: apiUrl,
291+
url: `${apiUrl}?per_page=100`,
292292
headers,
293293
});
294294

0 commit comments

Comments
 (0)