From d096c2291108feedf7830818dc76dd3255dae3b9 Mon Sep 17 00:00:00 2001 From: Max Schmidt Date: Tue, 27 Jun 2023 00:09:30 +0200 Subject: [PATCH] Add development check before triggering workflow Signed-off-by: Max Schmidt --- payload/src/collections/Posts.ts | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/payload/src/collections/Posts.ts b/payload/src/collections/Posts.ts index 95a20fb..c063e3d 100644 --- a/payload/src/collections/Posts.ts +++ b/payload/src/collections/Posts.ts @@ -16,21 +16,22 @@ const Posts: CollectionConfig = { console.log(process.env.TOKEN); try { - console.log( - await fetch( - `https://api.github.com/repos/${process.env.REPOSITORY}/dispatches`, - { - method: "POST", - headers: { - Accept: "application/vnd.github.everest-preview+json", - Authorization: `token ${process.env.TOKEN}`, - }, - body: JSON.stringify({ - event_type: "payload_update", - }), - } - ) - ); + process.env.NODE_ENV !== "development" && + console.log( + await fetch( + `https://api.github.com/repos/${process.env.REPOSITORY}/dispatches`, + { + method: "POST", + headers: { + Accept: "application/vnd.github.everest-preview+json", + Authorization: `token ${process.env.TOKEN}`, + }, + body: JSON.stringify({ + event_type: "payload_update", + }), + } + ) + ); } catch (e) { console.log(e); }