From b5a9338aa3f4e351375e4dbf1859458a7ded5952 Mon Sep 17 00:00:00 2001 From: branberry Date: Thu, 31 Aug 2023 18:59:25 -0500 Subject: [PATCH] [FEATURE]: Use path.join --- .github/scripts/webhook-pr-comment.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/scripts/webhook-pr-comment.js b/.github/scripts/webhook-pr-comment.js index 281b841da..22d04cea5 100644 --- a/.github/scripts/webhook-pr-comment.js +++ b/.github/scripts/webhook-pr-comment.js @@ -1,16 +1,17 @@ const fs = require('fs'); - +const path = require('path'); module.exports = () => { try { - const outputsFile = fs.readFileSync('cdk-infra/outputs.json').toString(); + const outputsFile = fs.readFileSync(path.join(process.cwd(), 'cdk-infra/outputs.json')).toString(); const outputs = JSON.parse(outputsFile); console.log('github', github); console.log(github.head_ref); console.log(outputsFile); + console.log(process.env.GIT_BRANCH); const webhook = Object.values(outputs[`auto-builder-stack-enhancedApp-stg-${process.env.GIT_BRANCH}-webhooks`])[0]; return webhook; } catch (error) { - console.log('Error occurred when retrieving Webhook URL'); + console.log('Error occurred when retrieving Webhook URL', error); return ''; } };