Skip to content

Commit 50b91da

Browse files
committed
sync_labels_fixes initial
1 parent 6ea1fe9 commit 50b91da

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

.github/sync_labels.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ReviewDecision(Enum):
5656
"""
5757
changes_requested = 'CHANGES_REQUESTED'
5858
approved = 'APPROVED'
59-
unclear = 'COMMENTED'
59+
unclear = 'UNCLEAR'
6060

6161
class Priority(Enum):
6262
r"""
@@ -319,12 +319,15 @@ def get_review_decision(self):
319319
return None
320320

321321
if self._review_decision is not None:
322+
if self._review_decision == ReviewDecision.unclear:
323+
return None
322324
return self._review_decision
323325

324326
data = self.view('reviewDecision')
325327
if data:
326328
self._review_decision = ReviewDecision(data)
327329
else:
330+
# To separate a not supplied value from not cached (see https://github.com/sagemath/sage/pull/36177#issuecomment-1704022893 ff)
328331
self._review_decision = ReviewDecision.unclear
329332
info('Review decision for %s: %s' % (self._issue, self._review_decision.value))
330333
return self._review_decision
@@ -349,9 +352,9 @@ def get_reviews(self, complete=False):
349352
self.get_commits()
350353

351354
date = self._commit_date
352-
no_rev = ReviewDecision.unclear.value
355+
unproper_rev = RevState.commented.value
353356
new_revs = [rev for rev in self._reviews if rev['submittedAt'] > date]
354-
proper_new_revs = [rev for rev in new_revs if rev['state'] != no_rev]
357+
proper_new_revs = [rev for rev in new_revs if rev['state'] != unproper_rev]
355358
info('Proper reviews after %s for %s: %s' % (date, self._issue, proper_new_revs))
356359
return proper_new_revs
357360

@@ -463,11 +466,6 @@ def approve_allowed(self):
463466
r"""
464467
Return if the actor has permission to approve this PR.
465468
"""
466-
revs = self.get_reviews(complete=True)
467-
if not any(rev['authorAssociation'] in ('MEMBER', 'OWNER') for rev in revs):
468-
info('PR %s can\'t be approved because of missing member review' % (self._issue))
469-
return False
470-
471469
revs = self.get_reviews()
472470
revs = [rev for rev in revs if rev['author']['login'] != self._actor]
473471
ch_req = ReviewDecision.changes_requested

0 commit comments

Comments
 (0)