Last active
April 12, 2024 20:25
-
-
Save peternied/c8ac7fb4552cc36890969ca4b33e2cb0 to your computer and use it in GitHub Desktop.
For the OpenSearch repository determine which maintainers are likely to be Emeritus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
# List of GitHub IDs for the project maintainers | |
github_ids = [ | |
"abbashus", "anasalkouz", "andrross", "reta", "Bukhtawar", "CEHENKLE", "dbwiddis", "dblock", "gbbafna", "setiah", | |
"kotwanikunal", "mch2", "msfroh", "nknize", "owaiskazi19", "peternied", "adnapibar", "Rishikesh1159", "ryanbogan", | |
"sachinpkale", "saratvemulapalli", "shwetathareja", "sohami", "dreamer-89", "tlfeng", "VachaShah" | |
] | |
# GitHub repository to query | |
repo = "opensearch-project/OpenSearch" | |
# Date to check for updates since (last 6 months) | |
date_since = "2023-11-01" | |
# Print the markdown table headers | |
print("| Maintainer ID | Interactions in Last 6 Months | Status Change |") | |
print("|---------------|-------------------------------|---------------|") | |
# Header for GitHub API | |
headers = { | |
"Accept": "application/vnd.github.v3+json" | |
} | |
# Fetch interaction data for each maintainer | |
for user in github_ids: | |
url = f"https://api.github.com/search/issues?q=commenter%3A{user}+repo%3A{repo}+updated%3A%3E{date_since}&type=issues" | |
time.sleep(5) # Delay to prevent hitting API rate limits | |
response = requests.get(url, headers=headers) | |
if response.status_code == 200: | |
count = response.json().get("total_count", 0) | |
status = "emeritus" if count < 5 else "maintainer" | |
# Print each row of the table with links | |
print(f"| [{user}](https://github.com/{user}) | [{count}](https://github.com/{repo}/search?q=commenter%3A{user}+updated%3A%3E{date_since}) | {status} |") | |
else: | |
print(f"| [{user}](https://github.com/{user}) | [Error](https://github.com/{repo}/search?q=commenter%3A{user}+updated%3A%3E{date_since}) | Check manually, [link](https://api.github.com/search/issues?q=commenter%3A{user}+repo%3A{repo}+updated%3A%3E{date_since}&type=issues) |") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment