From 7d6bca265a3d39556c8804dc2ded430d4c6acb1b Mon Sep 17 00:00:00 2001 From: Maxim Geraskin Date: Fri, 20 Oct 2023 18:18:27 +0200 Subject: [PATCH] Update main.yml --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c7f639..88ce982 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,14 +19,14 @@ jobs: let issueBody = ''; // Check if the trigger was an issue or comment event - if (context.eventName === 'issues') { + if (context.eventName === 'issues' && context.payload.issue) { issueBody = context.payload.issue.body; - } else if (context.eventName === 'issue_comment') { + } else if (context.eventName === 'issue_comment' && context.payload.comment) { issueBody = context.payload.comment.body; } - // Check if the content contains "hello" - if (issueBody.includes('hello')) { + // Ensure issueBody is not undefined or null before proceeding + if (issueBody && issueBody.includes('hello')) { // Add a comment to the current issue await github.rest.issues.createComment({ owner: repositoryContext.owner,