Created
April 19, 2023 00:23
-
-
Save n0samu/f0f784a935a7179b9e7691a520c8291e to your computer and use it in GitHub Desktop.
Script to calculate Ruffle's AVM1 implementation progress based on tracking issues
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 sys | |
import requests | |
import re | |
from bs4 import BeautifulSoup | |
ISSUES_BASE = 'ruffle-rs/ruffle/issues/' | |
def get_issue_progress(issue_url): | |
htmlResponse = requests.get(issue_url) | |
soup = BeautifulSoup(htmlResponse.text, "html.parser") | |
progress_elem = soup.find('tracked-issues-progress') | |
total_items = int(progress_elem.get('data-total')) | |
completed_items = int(progress_elem.get('data-completed')) | |
return (completed_items, total_items) | |
issues_base_url = f'https://github.com/{ISSUES_BASE}' | |
if len(sys.argv) != 2: | |
print('Usage: python trackingIssuesProgress.py issueNumber') | |
sys.exit() | |
issue_num = sys.argv[1] | |
issue_url = f'{issues_base_url}{issue_num}' | |
json_url = f'https://api.github.com/repos/{ISSUES_BASE}{issue_num}' | |
json_data = requests.get(json_url).json() | |
issue_text = json_data['body'] | |
linked_issues = re.findall(f'\\(({issues_base_url}.*?)\\)', issue_text) | |
all_issues = [issue_url] + linked_issues | |
completed_items = 0 | |
total_items = 0 | |
for issue in all_issues: | |
issue_completed_items, issue_total_items = get_issue_progress(issue) | |
completed_items += issue_completed_items | |
total_items += issue_total_items | |
percentage = '{:2.0f}%'.format(completed_items / total_items * 100) | |
print(f'{completed_items} of {total_items} tasks: {percentage} complete') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment