Skip to content

Commit

Permalink
Check if there are maintainers
Browse files Browse the repository at this point in the history
  • Loading branch information
BastianZim committed Nov 8, 2023
1 parent af0de7f commit 4c5da51
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions conda_smithy/lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,28 +903,31 @@ def run_conda_forge_specific(meta, recipe_dir, lints, hints):

# 3: Check if all listed maintainers have commented:
if is_staged_recipes:
# Get PR details using GitHub API
current_pr = gh.get_repo("conda-forge/staged-recipes").get_pull(int(pr_number))

# Get PR author, issue comments, and review comments
pr_author = current_pr.user.login
issue_comments = current_pr.get_issue_comments()
review_comments = current_pr.get_reviews()

# Combine commenters from both issue comments and review comments
commenters = {comment.user.login for comment in issue_comments}
commenters.update({review.user.login for review in review_comments})

# Check if all maintainers have either commented or are the PR author
non_participating_maintainers = set()
for maintainer in maintainers:
if maintainer not in commenters and maintainer != pr_author:
non_participating_maintainers.add(maintainer)

# Add a lint message if there are any non-participating maintainers
if non_participating_maintainers:
lints.append(f"The following maintainers have not yet confirmed that they are willing to be listed here: "
"{', '.join(non_participating_maintainers)}. Please ask them to comment on this PR if they are.")
if maintainers:
# Get PR details using GitHub API
current_pr = gh.get_repo("conda-forge/staged-recipes").get_pull(int(pr_number))

# Get PR author, issue comments, and review comments
pr_author = current_pr.user.login
issue_comments = current_pr.get_issue_comments()
review_comments = current_pr.get_reviews()

# Combine commenters from both issue comments and review comments
commenters = {comment.user.login for comment in issue_comments}
commenters.update({review.user.login for review in review_comments})

# Check if all maintainers have either commented or are the PR author
non_participating_maintainers = set()
for maintainer in maintainers:
if maintainer not in commenters and maintainer != pr_author:
non_participating_maintainers.add(maintainer)

# Add a lint message if there are any non-participating maintainers
if non_participating_maintainers:
lints.append(f"The following maintainers have not yet confirmed that they are willing to be listed here: "
"{', '.join(non_participating_maintainers)}. Please ask them to comment on this PR if they are.")
else:
lints.append("There are no maintainers listed in the recipe. Please add some.")

# 4: if the recipe dir is inside the example dir
if recipe_dir is not None and "recipes/example/" in recipe_dir:
Expand Down

0 comments on commit 4c5da51

Please sign in to comment.