feat!: Remove manual API calling tests

These tests are no longer used since the switch to OctokitWrapper, and
conflict with packages required for the implementation of throttling, so
remove them.
This commit is contained in:
Thomas A. Christensen II 2024-01-14 21:50:57 -06:00
parent 8982670453
commit 2098c3cdb2

View file

@ -1,5 +1,3 @@
import fetch from "node-fetch"
export function getToken(first: boolean): string {
const token = process.env["GITHUB_TOKEN"] || ""
if (!token && first) {
@ -12,31 +10,3 @@ export function getToken(first: boolean): string {
return token
}
/**
* Retrieves the release from a GitHub repository. This function allows to fetch
* either the latest release or the latest pre-release ("edge" release).
*
* @param {string} repo - The GitHub repository to fetch the release from,
* in the format 'owner/repo'.
* @param {boolean} [prerelease] - If true, fetches the latest pre-release.
* If false or undefined, fetches the latest release regardless of whether
* it's a pre-release or not.
*
* @returns {Promise<string>} A Promise that resolves to a string representing the tag name
* of the found release. If no release is found, the Promise resolves to 'Release not found'.
*/
export async function getReleaseTag(
repo: string,
prerelease?: boolean
): Promise<string> {
const response = await fetch(`https://api.github.com/repos/${repo}/releases`)
const releases = await response.json()
const release = releases.find(
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
(rel: any) => prerelease === undefined || rel.prerelease === prerelease
)
return release ? release.tag_name : "No release found"
}