From 04c60766e9e4091b4501be1eb06fff88cd70d62e Mon Sep 17 00:00:00 2001 From: Amadeo Pellicce Date: Fri, 10 Mar 2023 11:56:41 -0800 Subject: [PATCH] adding defensive checks --- src/releaser/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/releaser/index.ts b/src/releaser/index.ts index b5227fe..aa56911 100644 --- a/src/releaser/index.ts +++ b/src/releaser/index.ts @@ -2,6 +2,18 @@ import { updateAlgoliaSearch } from "./algolia"; import { createAssetDb } from "./db/sync-database"; export async function releaseDb(directory = '/tmp/assets') { + if(!process.env.GITHUB_TOKEN) { + throw new Error('Missing Github Token'); + } + + if(!process.env.ALGOLIA_APP_ID) { + throw new Error('Missing Algolia App ID'); + } + + if(!process.env.ALGOLIA_API_KEY) { + throw new Error('Missing Algolia API Key'); + } + return Promise.all([ createAssetDb(directory), updateAlgoliaSearch(directory)