|
90 | 90 |
|
91 | 91 | // Assigns reviewers to a single PR, mutating load/activeCount in place. |
92 | 92 | async function assignReviewers(pr, load, activeCount) { |
93 | | - const assigned = getPoolAssignees(pr); |
| 93 | + const author = pr.user.login; |
| 94 | + // Exclude the author from assigned count — they can't review their own PR. |
| 95 | + const assigned = getPoolAssignees(pr).filter((a) => a !== author); |
94 | 96 | const needed = REQUIRED_REVIEWERS - assigned.length; |
95 | 97 | const weight = getWeight(pr); |
96 | 98 |
|
@@ -153,8 +155,9 @@ jobs: |
153 | 155 | return; |
154 | 156 | } |
155 | 157 | const assigned = getPoolAssignees(triggerPR); |
156 | | - if (assigned.length >= REQUIRED_REVIEWERS) { |
157 | | - core.info(`Triggering PR #${triggerPR.number} already has ${assigned.length} pool assignees. Exiting.`); |
| 158 | + const author = triggerPR.user.login; |
| 159 | + if (assigned.filter((a) => a !== author).length >= REQUIRED_REVIEWERS) { |
| 160 | + core.info(`Triggering PR #${triggerPR.number} already has ${assigned.length} pool assignees (excl. author). Exiting.`); |
158 | 161 | return; |
159 | 162 | } |
160 | 163 | core.info(`Triggering PR #${triggerPR.number} needs reviewers. Proceeding with load calculation.`); |
@@ -200,7 +203,10 @@ jobs: |
200 | 203 | } else { |
201 | 204 | // Full-scan mode (workflow_dispatch / schedule): process all eligible PRs that need reviewers. |
202 | 205 | const needsReviewers = eligiblePRs |
203 | | - .filter((pr) => getPoolAssignees(pr).length < REQUIRED_REVIEWERS) |
| 206 | + .filter((pr) => { |
| 207 | + const assigned = getPoolAssignees(pr).filter((a) => a !== pr.user.login); |
| 208 | + return assigned.length < REQUIRED_REVIEWERS; |
| 209 | + }) |
204 | 210 | .sort((a, b) => getWeight(b) - getWeight(a)); |
205 | 211 |
|
206 | 212 | core.info(`PRs needing reviewers: ${needsReviewers.length}`); |
|
0 commit comments