Auto-label PR if above threshold for positive reactions (#13605)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Burhan 2024-08-25 20:27:24 -04:00 committed by GitHub
parent a1e72d3ffd
commit 0b0bc56675
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -47,6 +47,11 @@ jobs:
for pr in repo.get_pulls(state='open', sort='created'):
try:
# Label PRs as popular for positive reactions
reactions = pr.as_issue().get_reactions()
if sum([(1 if r.content not in {"-1", "confused"} else 0) for r in reactions]) > 5:
pr.set_labels(*("popular",) + tuple(l.name for l in pr.get_labels()))
# Get full names for repositories and branches
base_repo_name = repo.full_name
head_repo_name = pr.head.repo.full_name