Sponsorship auto-generate v0.1.39 + columns fix in maintenance

This commit is contained in:
Jokob-sk
2024-01-28 22:21:16 +11:00
parent bb25685691
commit d1e46b29d0
4 changed files with 33 additions and 144 deletions

View File

@@ -3,9 +3,8 @@ import requests
import base64
def fetch_sponsors():
global headers
graphql_url = "https://api.github.com/graphql"
headers = {
"Authorization": f"Bearer {os.environ.get('GH_TOKEN')}",
@@ -72,13 +71,20 @@ def fetch_sponsors():
"monthly_price": monthly_price,
}
if created_at == sponsorship["createdAt"]:
past_sponsors.append(sponsor)
else:
# Check if the sponsorship is current or past
if privacy_level == "PUBLIC":
current_sponsors.append(sponsor)
else:
past_sponsors.append(sponsor)
print("Current Sponsors:")
print(current_sponsors)
print("\nPast Sponsors:")
print(past_sponsors)
return {"current_sponsors": current_sponsors, "past_sponsors": past_sponsors}
def generate_sponsors_table(current_sponsors, past_sponsors):
current_table = "| Current Sponsors |\n|---|\n"
for sponsor in current_sponsors: