Skip to content

Commit 2fbf1a3

Browse files
committed
feat: adding error handling
1 parent f16b004 commit 2fbf1a3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@ const waitForUrl = async (url, MAX_TIMEOUT) => {
1919
const run = async () => {
2020
try {
2121
const PR_NUMBER = github.context.payload.number;
22+
if (!PR_NUMBER) {
23+
core.setFailed(
24+
"Action must be run in conjunction with the `pull_request` event"
25+
);
26+
}
2227
const MAX_TIMEOUT = Number(core.getInput("site_name")) || 60;
2328
const siteName = core.getInput("site_name");
29+
if (!siteName) {
30+
core.setFailed("Required field `site_name` was not provided");
31+
}
2432
const url = `https://deploy-preview-${PR_NUMBER}--${siteName}.netlify.com`;
2533
console.log(`Waiting for a 200 from: ${url}`);
2634
await waitForUrl(url, MAX_TIMEOUT);

0 commit comments

Comments
 (0)