Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/actions/people/app/main.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import logging
import subprocess
import sys
from collections import Counter
from datetime import datetime, timedelta, timezone
from pathlib import Path
from typing import Container, Dict, List, Optional, Set

import httpx
from github import Github
import yaml
from github import Github
from pydantic import BaseModel, BaseSettings, SecretStr

github_graphql_url = "https://api.github.com/graphql"
Expand Down Expand Up @@ -487,13 +488,17 @@ def get_top_users(
"sponsors": sponsors,
}
people_path = Path("./docs/en/data/people.yml")
people_path.write_text(
yaml.dump(people, sort_keys=False, width=200, allow_unicode=True),
encoding="utf-8",
)
people_old_content = people_path.read_text(encoding="utf-8")
new_content = yaml.dump(people, sort_keys=False, width=200, allow_unicode=True)
if people_old_content == new_content:
logging.info("The FastAPI People data hasn't changed, finishing.")
sys.exit(0)
people_path.write_text(new_content, encoding="utf-8")
logging.info("Setting up GitHub Actions git user")
subprocess.run(["git", "config", "user.name", "github-actions"], check=True)
subprocess.run(["git", "config", "user.email", "[email protected]"], check=True)
subprocess.run(
["git", "config", "user.email", "[email protected]"], check=True
)
branch_name = "fastapi-people"
logging.info(f"Creating a new branch {branch_name}")
subprocess.run(["git", "checkout", "-b", branch_name], check=True)
Expand Down