diff --git a/.github/workflows/merge-to-stage.js b/.github/workflows/merge-to-stage.js index 6fb721f3fe..e615c96538 100644 --- a/.github/workflows/merge-to-stage.js +++ b/.github/workflows/merge-to-stage.js @@ -236,7 +236,7 @@ const main = async (params) => { const stageToMainPR = await getStageToMainPR(); console.log('has Stage to Main PR:', !!stageToMainPR); if (stageToMainPR) body = stageToMainPR.body; - existingPRCount = body.match(/https:\/\/github\.com\/adobecom\/milo\/pull\/\d+/g).length; + existingPRCount = body.match(/https:\/\/github\.com\/adobecom\/milo\/pull\/\d+/g)?.length || 0; console.log(`Number of PRs already in the batch: ${existingPRCount}`); if (mergeLimitExceeded()) return console.log(`Maximum number of '${MAX_MERGES}' PRs already merged. Stopping execution`);