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);