From cbca6591401fae97acd8ce8a720bc8908e355b26 Mon Sep 17 00:00:00 2001 From: Victor Alfaro Date: Wed, 4 Sep 2024 20:23:20 -0600 Subject: [PATCH] #29618: making secure fallback option when no issue is provided --- .github/workflows/issue_comp_next-release-label.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/issue_comp_next-release-label.yml b/.github/workflows/issue_comp_next-release-label.yml index f04f76508e66..8259aa4d0c6a 100644 --- a/.github/workflows/issue_comp_next-release-label.yml +++ b/.github/workflows/issue_comp_next-release-label.yml @@ -58,15 +58,20 @@ jobs: }); } - let issueNumber = ('${{ inputs.issue_number }}'.trim() && parseInt('${{ inputs.issue_number }}')) || -1; - const issue = context.payload.issue || await getIssue(issueNumber); + let issue = context.payload.issue; if (!issue) { + if (!!'${{ inputs.issue_number }}') { + issue = await getIssue(${{ inputs.issue_number }}); + } + + if (!issue) { console.log('Issue [${{ inputs.issue_number }}] not found'); process.exit(0); + } } console.log(`Issue: ${JSON.stringify(issue, null, 2)}`); - issueNumber = issue.data.number; + const issueNumber = issue.data.number; const dropAndLearnText = 'Drop Everything & Learn'; if (issue.data.title.includes(dropAndLearnText)) {