From 2739f74455880a56448aa1bbc6f2d9fdfb003aa2 Mon Sep 17 00:00:00 2001 From: gitcommitshow <56937085+gitcommitshow@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:49:17 +0530 Subject: [PATCH] fix: missed null checks (#54) --- src/helpers.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers.js b/src/helpers.js index bde3593..e864065 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -122,13 +122,13 @@ export async function afterCLA(app, claSignatureInfo) { order: "desc" }); - const filteredPrs = prs?.filter(pr => pr.user.login === githubUsername); - console.log(`Found ${filteredPrs?.length} open PRs for ${githubUsername} in ${org}:`, filteredPrs?.map(pr => pr.number).join(', ')); + const filteredPrs = prs?.filter(pr => pr?.user?.login === githubUsername); + console.log(`Found ${filteredPrs?.length} open PRs for ${githubUsername} in ${org}:`, filteredPrs?.map(pr => pr?.number).join(', ')); let failuresToRemoveLabel = 0; for (const pr of filteredPrs) { const { owner, repo } = parseRepoUrl(pr?.repository_url) || {}; const hasPendingCLALabel = pr.labels?.some(label => label?.name?.toLowerCase() === "pending cla"); - console.log(`PR #${pr.number} has "Pending CLA" label: ${hasPendingCLALabel}`); + console.log(`PR #${pr?.number} has "Pending CLA" label: ${hasPendingCLALabel}`); if (hasPendingCLALabel) { try { await removePendingCLALabel(octokit, owner, repo, pr?.number);