From 0b0bc56675997fe66b13aa0d250b777c8a467e32 Mon Sep 17 00:00:00 2001 From: Burhan <62214284+Burhan-Q@users.noreply.github.com> Date: Sun, 25 Aug 2024 20:27:24 -0400 Subject: [PATCH] Auto-label PR if above threshold for positive reactions (#13605) Co-authored-by: Glenn Jocher Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com> Co-authored-by: UltralyticsAssistant --- .github/workflows/merge-main-into-prs.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/merge-main-into-prs.yml b/.github/workflows/merge-main-into-prs.yml index 2c04e95b..328775a2 100644 --- a/.github/workflows/merge-main-into-prs.yml +++ b/.github/workflows/merge-main-into-prs.yml @@ -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