@@ -23,21 +23,20 @@ jobs:
2323 pull_number: pr.number,
2424 });
2525
26- // Count unique human approvals (latest review per user)
26+ // Determine if PR author is a bot/GitHub Actions
27+ const authorType = pr.user.type; // 'Bot' vs 'User'
28+ const authorLogin = pr.user.login; // e.g. 'github-actions[bot]'
29+ const isBot = authorType === 'Bot' || authorLogin.endsWith('[bot]');
30+ const oneApprovalBotAuthors = new Set(['renovate[bot]']);
31+
32+ // Count unique approvals, including bot approvals.
2733 const latestByUser = {};
2834 for (const review of reviews.data) {
29- if (review.user.type === 'Bot') continue;
3035 latestByUser[review.user.login] = review.state;
3136 }
3237 const approvalCount = Object.values(latestByUser)
3338 .filter(state => state === 'APPROVED').length;
3439
35- // Determine if PR author is a bot/GitHub Actions
36- const authorType = pr.user.type; // 'Bot' vs 'User'
37- const authorLogin = pr.user.login; // e.g. 'github-actions[bot]'
38- const isBot = authorType === 'Bot' || authorLogin.endsWith('[bot]');
39- const oneApprovalBotAuthors = new Set(['renovate[bot]']);
40-
4140 const required = isBot && !oneApprovalBotAuthors.has(authorLogin) ? 2 : 1;
4241
4342 console.log(`PR author: ${authorLogin} (${authorType}), isBot: ${isBot}`);
4645
4746 if (isBot && (approvalCount < required)) {
4847 core.setFailed(
49- `This PR needs ${required} human approval(s) but has ${approvalCount}. ` +
48+ `This PR needs ${required} approval(s) but has ${approvalCount}. ` +
5049 `(Author is ${isBot ? 'a bot' : 'human'})`
5150 );
5251 }
0 commit comments