mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 21:04:59 +00:00
feat: Add Aider contribution percentage to badges script
This commit is contained in:
parent
eaac00ad3f
commit
a5614bfe40
1 changed files with 32 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
@ -48,6 +49,33 @@ def get_github_stars(repo="paul-gauthier/aider"):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def get_aider_percentage():
|
||||||
|
"""
|
||||||
|
Get the percentage of code written by Aider in the latest release
|
||||||
|
from the blame.yml file
|
||||||
|
"""
|
||||||
|
blame_path = os.path.join(
|
||||||
|
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
|
||||||
|
"aider", "website", "_data", "blame.yml"
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open(blame_path, 'r') as f:
|
||||||
|
blame_data = yaml.safe_load(f)
|
||||||
|
|
||||||
|
# Get the most recent release (first entry in the list)
|
||||||
|
if blame_data and len(blame_data) > 0:
|
||||||
|
latest_release = blame_data[0]
|
||||||
|
percentage = latest_release.get('aider_percentage', 0)
|
||||||
|
version = latest_release.get('end_tag', 'unknown')
|
||||||
|
return percentage, version
|
||||||
|
|
||||||
|
return 0, 'unknown'
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error reading blame data: {e}", file=sys.stderr)
|
||||||
|
return 0, 'unknown'
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Load environment variables from .env file
|
# Load environment variables from .env file
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
@ -87,6 +115,10 @@ def main():
|
||||||
stars = get_github_stars(args.github_repo)
|
stars = get_github_stars(args.github_repo)
|
||||||
if stars is not None:
|
if stars is not None:
|
||||||
print(f"GitHub stars for {args.github_repo}: {stars:,}")
|
print(f"GitHub stars for {args.github_repo}: {stars:,}")
|
||||||
|
|
||||||
|
# Get Aider contribution percentage in latest release
|
||||||
|
percentage, version = get_aider_percentage()
|
||||||
|
print(f"Aider wrote {percentage:.2f}% of code in the latest release ({version})")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue