Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Remove unused function #7

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions src/util/GitHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,38 +118,3 @@ export async function fetchManifest(repository: string, tag_name?: string): Prom
console.error(e);
}
}

/**
* Downloads the assets from a release from GitHub
* @param repository The <user>/<repo> of the plugin
* @param tag_name The name of the tag associated with a release.
* @returns The Assets attached to the release as string
* @todo Checksum
*/
export async function downloadReleaseAssets(repository: string, tag_name: string): Promise<File[] | undefined> {
const URL = `https://api.github.com/repos/${repository}/releases/tags/${tag_name}`;
try {
if (!repositoryRegEx.test(repository)) {
throw Error('Repository string do not match the pattern!');
}
const response = await request({ url: URL });
const data = await JSON.parse(response);
const assets: Asset[] = data.assets;

const assetData: File[] = [];

assets.forEach(async (asset) => {
const URL = asset.browser_download_url;
const response = await request({
url: URL,
});
assetData.push({ name: asset.name, data: response });
});

return assetData;
}
catch (e) {
(e as Error).message = 'Failed to fetch the release for plugin! ' + (e as Error).message;
console.error(e);
}
}