-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE]: Add try catch and conditional for commenting
- Loading branch information
Showing
2 changed files
with
13 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
const fs = require('fs'); | ||
|
||
module.exports = ({ github }) => { | ||
const outputsFile = fs.readFileSync('cdk-infra/outputs.json').toString(); | ||
const outputs = JSON.parse(outputsFile); | ||
console.log(github.head_ref); | ||
console.log(outputsFile); | ||
const webhook = Object.values(outputs[`auto-builder-stack-enhancedApp-stg-${github.head_ref}-webhooks`])[0]; | ||
return webhook; | ||
try { | ||
const outputsFile = fs.readFileSync('cdk-infra/outputs.json').toString(); | ||
const outputs = JSON.parse(outputsFile); | ||
console.log('github', github); | ||
console.log(github.head_ref); | ||
console.log(outputsFile); | ||
const webhook = Object.values(outputs[`auto-builder-stack-enhancedApp-stg-${github.head_ref}-webhooks`])[0]; | ||
return webhook; | ||
} catch (error) { | ||
console.log('Error occurred when retrieving Webhook URL'); | ||
return ''; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters