mirror of
https://github.com/ow-mods/ow-mod-db.git
synced 2025-12-11 20:15:24 +01:00
27 lines
632 B
TypeScript
27 lines
632 B
TypeScript
import { getOctokit } from "./get-octokit";
|
|
|
|
export async function getPreviousDatabase() {
|
|
const octokit = getOctokit();
|
|
|
|
const previousDatabaseResponse: any = (
|
|
await octokit.rest.repos.getContent({
|
|
// TODO get owner and repo from current action repo.
|
|
owner: "ow-mods",
|
|
repo: "ow-mod-db",
|
|
path: "database.json",
|
|
ref: "master",
|
|
mediaType: {
|
|
format: "raw",
|
|
},
|
|
})
|
|
).data;
|
|
|
|
const responseJson = JSON.parse(previousDatabaseResponse);
|
|
const previousDatabase: Mod[] = [
|
|
...responseJson.releases,
|
|
...responseJson.alphaReleases,
|
|
];
|
|
|
|
return previousDatabase;
|
|
}
|