Skip to content

Commit 1db3e61

Browse files
authored
Merge pull request #7361 from brice-stacks/fix/nagbot-changes-requested
ci(nag-bot): handle changes requested
2 parents c034a78 + e43a964 commit 1db3e61

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

.github/workflows/_slack-pr-nag.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,33 +246,40 @@ jobs:
246246
247247
// 4. Classify the PRs locally (Hierarchical Triage Engine)
248248
let explanation = '';
249-
let sortWeight = 5;
249+
let sortWeight = 7;
250250
let statusIcon = '👀';
251-
252-
if (unresolvedComments.length > 0) {
253-
const count = unresolvedComments.length;
254-
explanation = `${count} ${count === 1 ? 'comment' : 'comments'} to resolve`;
251+
252+
const changesRequested = pr.requested_reviewers
253+
.some(r => r.state === 'CHANGES_REQUESTED');
254+
const resolveCount = unresolvedComments.length;
255+
256+
if (changesRequested) {
257+
explanation = `Changes requested`;
255258
sortWeight = 1;
259+
statusIcon = '🛑';
260+
} else if (resolveCount > 0) {
261+
explanation = `${resolveCount} ${resolveCount === 1 ? 'comment' : 'comments'} to resolve`;
262+
sortWeight = 2;
256263
statusIcon = '💬';
257264
} else if (pr.merge_conflict_present) {
258265
explanation = `Needs merge conflicts fixed`;
259-
sortWeight = 2;
266+
sortWeight = 3;
260267
statusIcon = '⚠️';
261268
} else if (pr.out_of_date_with_base) {
262269
explanation = `Needs rebase/merge`;
263-
sortWeight = 3;
270+
sortWeight = 4;
264271
statusIcon = '⏩';
265272
} else if (approvedCount >= 2) {
266273
explanation = `Ready for merge`;
267274
sortWeight = 0;
268275
statusIcon = '✅';
269276
} else if (allReviewersSuperset.length === 0) {
270277
explanation = `Needs reviewers assigned`;
271-
sortWeight = 5;
278+
sortWeight = 6;
272279
statusIcon = '👥';
273280
} else {
274281
explanation = `Needs reviews`;
275-
sortWeight = 4;
282+
sortWeight = 5;
276283
statusIcon = '⏳';
277284
}
278285

0 commit comments

Comments
 (0)