mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-03 16:56:17 +08:00
Remove the people page from the documentation (#343)
This commit is contained in:
@@ -1,26 +0,0 @@
|
|||||||
name: 'Update People Action'
|
|
||||||
description: 'Retrieves people information from GitHub, saves it in people.yaml and opens a PR'
|
|
||||||
inputs:
|
|
||||||
token:
|
|
||||||
description: 'User token for accessing the GitHub API. Can be passed in using {{ secrets.GITHUB_TOKEN }}'
|
|
||||||
required: true
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: 'composite'
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: set up python
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.12'
|
|
||||||
|
|
||||||
- name: install deps
|
|
||||||
run: pip install -U PyGithub pyyaml pydantic pydantic-settings
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: update people
|
|
||||||
run: python .github/actions/people/people.py
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
INPUT_TOKEN: ${{ inputs.token }}
|
|
||||||
@@ -1,640 +0,0 @@
|
|||||||
"""Use the github API to get lists of people who have contributed in various ways to reflect-cpp.
|
|
||||||
|
|
||||||
The script is borrowed from the
|
|
||||||
[pydantic project](https://github.com/pydantic/pydantic/blob/main/.github/actions/people/people.py),
|
|
||||||
and modified to work with the reflect-cpp repository.
|
|
||||||
|
|
||||||
Originally, the logic comes from
|
|
||||||
[FastAPI](https://github.com/tiangolo/fastapi/blob/master/.github/actions/people/app/main.py).
|
|
||||||
"""
|
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
from collections import Counter
|
|
||||||
from datetime import datetime, timedelta, timezone
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Any, Container, Dict, List, Set, Union
|
|
||||||
|
|
||||||
import requests
|
|
||||||
import yaml
|
|
||||||
from github import Github
|
|
||||||
from pydantic_settings import BaseSettings
|
|
||||||
|
|
||||||
from pydantic import BaseModel, SecretStr
|
|
||||||
|
|
||||||
github_graphql_url = "https://api.github.com/graphql"
|
|
||||||
|
|
||||||
discussions_query = """
|
|
||||||
query Q($after: String) {
|
|
||||||
repository(name: "reflect-cpp", owner: "getml") {
|
|
||||||
discussions(first: 100, after: $after) {
|
|
||||||
edges {
|
|
||||||
cursor
|
|
||||||
node {
|
|
||||||
number
|
|
||||||
author {
|
|
||||||
login
|
|
||||||
avatarUrl
|
|
||||||
url
|
|
||||||
}
|
|
||||||
title
|
|
||||||
createdAt
|
|
||||||
comments(first: 100) {
|
|
||||||
nodes {
|
|
||||||
createdAt
|
|
||||||
author {
|
|
||||||
login
|
|
||||||
avatarUrl
|
|
||||||
url
|
|
||||||
}
|
|
||||||
isAnswer
|
|
||||||
replies(first: 10) {
|
|
||||||
nodes {
|
|
||||||
createdAt
|
|
||||||
author {
|
|
||||||
login
|
|
||||||
avatarUrl
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
issues_query = """
|
|
||||||
query Q($after: String) {
|
|
||||||
repository(name: "reflect-cpp", owner: "getml") {
|
|
||||||
issues(first: 100, after: $after) {
|
|
||||||
edges {
|
|
||||||
cursor
|
|
||||||
node {
|
|
||||||
number
|
|
||||||
author {
|
|
||||||
login
|
|
||||||
avatarUrl
|
|
||||||
url
|
|
||||||
}
|
|
||||||
title
|
|
||||||
createdAt
|
|
||||||
state
|
|
||||||
comments(first: 100) {
|
|
||||||
nodes {
|
|
||||||
createdAt
|
|
||||||
author {
|
|
||||||
login
|
|
||||||
avatarUrl
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
prs_query = """
|
|
||||||
query Q($after: String) {
|
|
||||||
repository(name: "reflect-cpp", owner: "getml") {
|
|
||||||
pullRequests(first: 100, after: $after) {
|
|
||||||
edges {
|
|
||||||
cursor
|
|
||||||
node {
|
|
||||||
number
|
|
||||||
labels(first: 100) {
|
|
||||||
nodes {
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
author {
|
|
||||||
login
|
|
||||||
avatarUrl
|
|
||||||
url
|
|
||||||
}
|
|
||||||
title
|
|
||||||
createdAt
|
|
||||||
state
|
|
||||||
comments(first: 100) {
|
|
||||||
nodes {
|
|
||||||
createdAt
|
|
||||||
author {
|
|
||||||
login
|
|
||||||
avatarUrl
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reviews(first:100) {
|
|
||||||
nodes {
|
|
||||||
author {
|
|
||||||
login
|
|
||||||
avatarUrl
|
|
||||||
url
|
|
||||||
}
|
|
||||||
state
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class Author(BaseModel):
|
|
||||||
login: str
|
|
||||||
avatarUrl: str
|
|
||||||
url: str
|
|
||||||
|
|
||||||
|
|
||||||
# Issues and Discussions
|
|
||||||
|
|
||||||
|
|
||||||
class CommentsNode(BaseModel):
|
|
||||||
createdAt: datetime
|
|
||||||
author: Union[Author, None] = None
|
|
||||||
|
|
||||||
|
|
||||||
class Replies(BaseModel):
|
|
||||||
nodes: List[CommentsNode]
|
|
||||||
|
|
||||||
|
|
||||||
class DiscussionsCommentsNode(CommentsNode):
|
|
||||||
replies: Replies
|
|
||||||
|
|
||||||
|
|
||||||
class Comments(BaseModel):
|
|
||||||
nodes: List[CommentsNode]
|
|
||||||
|
|
||||||
|
|
||||||
class DiscussionsComments(BaseModel):
|
|
||||||
nodes: List[DiscussionsCommentsNode]
|
|
||||||
|
|
||||||
|
|
||||||
class IssuesNode(BaseModel):
|
|
||||||
number: int
|
|
||||||
author: Union[Author, None] = None
|
|
||||||
title: str
|
|
||||||
createdAt: datetime
|
|
||||||
state: str
|
|
||||||
comments: Comments
|
|
||||||
|
|
||||||
|
|
||||||
class DiscussionsNode(BaseModel):
|
|
||||||
number: int
|
|
||||||
author: Union[Author, None] = None
|
|
||||||
title: str
|
|
||||||
createdAt: datetime
|
|
||||||
comments: DiscussionsComments
|
|
||||||
|
|
||||||
|
|
||||||
class IssuesEdge(BaseModel):
|
|
||||||
cursor: str
|
|
||||||
node: IssuesNode
|
|
||||||
|
|
||||||
|
|
||||||
class DiscussionsEdge(BaseModel):
|
|
||||||
cursor: str
|
|
||||||
node: DiscussionsNode
|
|
||||||
|
|
||||||
|
|
||||||
class Issues(BaseModel):
|
|
||||||
edges: List[IssuesEdge]
|
|
||||||
|
|
||||||
|
|
||||||
class Discussions(BaseModel):
|
|
||||||
edges: List[DiscussionsEdge]
|
|
||||||
|
|
||||||
|
|
||||||
class IssuesRepository(BaseModel):
|
|
||||||
issues: Issues
|
|
||||||
|
|
||||||
|
|
||||||
class DiscussionsRepository(BaseModel):
|
|
||||||
discussions: Discussions
|
|
||||||
|
|
||||||
|
|
||||||
class IssuesResponseData(BaseModel):
|
|
||||||
repository: IssuesRepository
|
|
||||||
|
|
||||||
|
|
||||||
class DiscussionsResponseData(BaseModel):
|
|
||||||
repository: DiscussionsRepository
|
|
||||||
|
|
||||||
|
|
||||||
class IssuesResponse(BaseModel):
|
|
||||||
data: IssuesResponseData
|
|
||||||
|
|
||||||
|
|
||||||
class DiscussionsResponse(BaseModel):
|
|
||||||
data: DiscussionsResponseData
|
|
||||||
|
|
||||||
|
|
||||||
# PRs
|
|
||||||
|
|
||||||
|
|
||||||
class LabelNode(BaseModel):
|
|
||||||
name: str
|
|
||||||
|
|
||||||
|
|
||||||
class Labels(BaseModel):
|
|
||||||
nodes: List[LabelNode]
|
|
||||||
|
|
||||||
|
|
||||||
class ReviewNode(BaseModel):
|
|
||||||
author: Union[Author, None] = None
|
|
||||||
state: str
|
|
||||||
|
|
||||||
|
|
||||||
class Reviews(BaseModel):
|
|
||||||
nodes: List[ReviewNode]
|
|
||||||
|
|
||||||
|
|
||||||
class PullRequestNode(BaseModel):
|
|
||||||
number: int
|
|
||||||
labels: Labels
|
|
||||||
author: Union[Author, None] = None
|
|
||||||
title: str
|
|
||||||
createdAt: datetime
|
|
||||||
state: str
|
|
||||||
comments: Comments
|
|
||||||
reviews: Reviews
|
|
||||||
|
|
||||||
|
|
||||||
class PullRequestEdge(BaseModel):
|
|
||||||
cursor: str
|
|
||||||
node: PullRequestNode
|
|
||||||
|
|
||||||
|
|
||||||
class PullRequests(BaseModel):
|
|
||||||
edges: List[PullRequestEdge]
|
|
||||||
|
|
||||||
|
|
||||||
class PRsRepository(BaseModel):
|
|
||||||
pullRequests: PullRequests
|
|
||||||
|
|
||||||
|
|
||||||
class PRsResponseData(BaseModel):
|
|
||||||
repository: PRsRepository
|
|
||||||
|
|
||||||
|
|
||||||
class PRsResponse(BaseModel):
|
|
||||||
data: PRsResponseData
|
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
|
||||||
input_token: SecretStr
|
|
||||||
github_repository: str = "getml/reflect-cpp"
|
|
||||||
request_timeout: int = 30
|
|
||||||
|
|
||||||
|
|
||||||
def get_graphql_response(
|
|
||||||
*,
|
|
||||||
settings: Settings,
|
|
||||||
query: str,
|
|
||||||
after: Union[str, None] = None,
|
|
||||||
) -> Dict[str, Any]:
|
|
||||||
headers = {"Authorization": f"token {settings.input_token.get_secret_value()}"}
|
|
||||||
variables = {"after": after}
|
|
||||||
response = requests.post(
|
|
||||||
github_graphql_url,
|
|
||||||
headers=headers,
|
|
||||||
timeout=settings.request_timeout,
|
|
||||||
json={"query": query, "variables": variables, "operationName": "Q"},
|
|
||||||
)
|
|
||||||
if response.status_code != 200:
|
|
||||||
logging.error(f"Response was not 200, after: {after}")
|
|
||||||
logging.error(response.text)
|
|
||||||
raise RuntimeError(response.text)
|
|
||||||
data = response.json()
|
|
||||||
if "errors" in data:
|
|
||||||
logging.error(f"Errors in response, after: {after}")
|
|
||||||
logging.error(data["errors"])
|
|
||||||
logging.error(response.text)
|
|
||||||
raise RuntimeError(response.text)
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def get_graphql_issue_edges(*, settings: Settings, after: Union[str, None] = None):
|
|
||||||
data = get_graphql_response(settings=settings, query=issues_query, after=after)
|
|
||||||
graphql_response = IssuesResponse.model_validate(data)
|
|
||||||
return graphql_response.data.repository.issues.edges
|
|
||||||
|
|
||||||
|
|
||||||
def get_graphql_question_discussion_edges(
|
|
||||||
*,
|
|
||||||
settings: Settings,
|
|
||||||
after: Union[str, None] = None,
|
|
||||||
):
|
|
||||||
data = get_graphql_response(
|
|
||||||
settings=settings,
|
|
||||||
query=discussions_query,
|
|
||||||
after=after,
|
|
||||||
)
|
|
||||||
graphql_response = DiscussionsResponse.model_validate(data)
|
|
||||||
return graphql_response.data.repository.discussions.edges
|
|
||||||
|
|
||||||
|
|
||||||
def get_graphql_pr_edges(*, settings: Settings, after: Union[str, None] = None):
|
|
||||||
data = get_graphql_response(settings=settings, query=prs_query, after=after)
|
|
||||||
graphql_response = PRsResponse.model_validate(data)
|
|
||||||
return graphql_response.data.repository.pullRequests.edges
|
|
||||||
|
|
||||||
|
|
||||||
def get_issues_experts(settings: Settings):
|
|
||||||
issue_nodes: List[IssuesNode] = []
|
|
||||||
issue_edges = get_graphql_issue_edges(settings=settings)
|
|
||||||
|
|
||||||
while issue_edges:
|
|
||||||
for edge in issue_edges:
|
|
||||||
issue_nodes.append(edge.node)
|
|
||||||
last_edge = issue_edges[-1]
|
|
||||||
issue_edges = get_graphql_issue_edges(settings=settings, after=last_edge.cursor)
|
|
||||||
|
|
||||||
commentors = Counter()
|
|
||||||
last_month_commentors = Counter()
|
|
||||||
authors: Dict[str, Author] = {}
|
|
||||||
|
|
||||||
now = datetime.now(tz=timezone.utc)
|
|
||||||
one_month_ago = now - timedelta(days=30)
|
|
||||||
|
|
||||||
for issue in issue_nodes:
|
|
||||||
issue_author_name = None
|
|
||||||
if issue.author:
|
|
||||||
authors[issue.author.login] = issue.author
|
|
||||||
issue_author_name = issue.author.login
|
|
||||||
issue_commentors = set()
|
|
||||||
for comment in issue.comments.nodes:
|
|
||||||
if comment.author:
|
|
||||||
authors[comment.author.login] = comment.author
|
|
||||||
if comment.author.login != issue_author_name:
|
|
||||||
issue_commentors.add(comment.author.login)
|
|
||||||
for author_name in issue_commentors:
|
|
||||||
commentors[author_name] += 1
|
|
||||||
if issue.createdAt > one_month_ago:
|
|
||||||
last_month_commentors[author_name] += 1
|
|
||||||
|
|
||||||
return commentors, last_month_commentors, authors
|
|
||||||
|
|
||||||
|
|
||||||
def get_discussions_experts(settings: Settings):
|
|
||||||
discussion_nodes: List[DiscussionsNode] = []
|
|
||||||
discussion_edges = get_graphql_question_discussion_edges(settings=settings)
|
|
||||||
|
|
||||||
while discussion_edges:
|
|
||||||
for discussion_edge in discussion_edges:
|
|
||||||
discussion_nodes.append(discussion_edge.node)
|
|
||||||
last_edge = discussion_edges[-1]
|
|
||||||
discussion_edges = get_graphql_question_discussion_edges(
|
|
||||||
settings=settings, after=last_edge.cursor
|
|
||||||
)
|
|
||||||
|
|
||||||
commentors = Counter()
|
|
||||||
last_month_commentors = Counter()
|
|
||||||
authors: Dict[str, Author] = {}
|
|
||||||
|
|
||||||
now = datetime.now(tz=timezone.utc)
|
|
||||||
one_month_ago = now - timedelta(days=30)
|
|
||||||
|
|
||||||
for discussion in discussion_nodes:
|
|
||||||
discussion_author_name = None
|
|
||||||
if discussion.author:
|
|
||||||
authors[discussion.author.login] = discussion.author
|
|
||||||
discussion_author_name = discussion.author.login
|
|
||||||
discussion_commentors = set()
|
|
||||||
for comment in discussion.comments.nodes:
|
|
||||||
if comment.author:
|
|
||||||
authors[comment.author.login] = comment.author
|
|
||||||
if comment.author.login != discussion_author_name:
|
|
||||||
discussion_commentors.add(comment.author.login)
|
|
||||||
for reply in comment.replies.nodes:
|
|
||||||
if reply.author:
|
|
||||||
authors[reply.author.login] = reply.author
|
|
||||||
if reply.author.login != discussion_author_name:
|
|
||||||
discussion_commentors.add(reply.author.login)
|
|
||||||
for author_name in discussion_commentors:
|
|
||||||
commentors[author_name] += 1
|
|
||||||
if discussion.createdAt > one_month_ago:
|
|
||||||
last_month_commentors[author_name] += 1
|
|
||||||
return commentors, last_month_commentors, authors
|
|
||||||
|
|
||||||
|
|
||||||
def get_experts(settings: Settings):
|
|
||||||
# Migrated to only use GitHub Discussions
|
|
||||||
# (
|
|
||||||
# issues_commentors,
|
|
||||||
# issues_last_month_commentors,
|
|
||||||
# issues_authors,
|
|
||||||
# ) = get_issues_experts(settings=settings)
|
|
||||||
(
|
|
||||||
discussions_commentors,
|
|
||||||
discussions_last_month_commentors,
|
|
||||||
discussions_authors,
|
|
||||||
) = get_discussions_experts(settings=settings)
|
|
||||||
# commentors = issues_commentors + discussions_commentors
|
|
||||||
commentors = discussions_commentors
|
|
||||||
# last_month_commentors = (
|
|
||||||
# issues_last_month_commentors + discussions_last_month_commentors
|
|
||||||
# )
|
|
||||||
last_month_commentors = discussions_last_month_commentors
|
|
||||||
# authors = {**issues_authors, **discussions_authors}
|
|
||||||
authors = {**discussions_authors}
|
|
||||||
return commentors, last_month_commentors, authors
|
|
||||||
|
|
||||||
|
|
||||||
def get_contributors(settings: Settings):
|
|
||||||
pr_nodes: List[PullRequestNode] = []
|
|
||||||
pr_edges = get_graphql_pr_edges(settings=settings)
|
|
||||||
|
|
||||||
while pr_edges:
|
|
||||||
for edge in pr_edges:
|
|
||||||
pr_nodes.append(edge.node)
|
|
||||||
last_edge = pr_edges[-1]
|
|
||||||
pr_edges = get_graphql_pr_edges(settings=settings, after=last_edge.cursor)
|
|
||||||
|
|
||||||
contributors = Counter()
|
|
||||||
commentors = Counter()
|
|
||||||
reviewers = Counter()
|
|
||||||
authors: Dict[str, Author] = {}
|
|
||||||
|
|
||||||
for pr in pr_nodes:
|
|
||||||
author_name = None
|
|
||||||
if pr.author:
|
|
||||||
authors[pr.author.login] = pr.author
|
|
||||||
author_name = pr.author.login
|
|
||||||
pr_commentors: Set[str] = set()
|
|
||||||
pr_reviewers: Set[str] = set()
|
|
||||||
for comment in pr.comments.nodes:
|
|
||||||
if comment.author:
|
|
||||||
authors[comment.author.login] = comment.author
|
|
||||||
if comment.author.login == author_name:
|
|
||||||
continue
|
|
||||||
pr_commentors.add(comment.author.login)
|
|
||||||
for author_name in pr_commentors:
|
|
||||||
commentors[author_name] += 1
|
|
||||||
for review in pr.reviews.nodes:
|
|
||||||
if review.author:
|
|
||||||
authors[review.author.login] = review.author
|
|
||||||
pr_reviewers.add(review.author.login)
|
|
||||||
for reviewer in pr_reviewers:
|
|
||||||
reviewers[reviewer] += 1
|
|
||||||
if pr.state == "MERGED" and pr.author:
|
|
||||||
contributors[pr.author.login] += 1
|
|
||||||
return contributors, commentors, reviewers, authors
|
|
||||||
|
|
||||||
|
|
||||||
def get_top_users(
|
|
||||||
*,
|
|
||||||
counter: Counter,
|
|
||||||
min_count: int,
|
|
||||||
authors: Dict[str, Author],
|
|
||||||
skip_users: Container[str],
|
|
||||||
):
|
|
||||||
users = []
|
|
||||||
for commentor, count in counter.most_common(50):
|
|
||||||
if commentor in skip_users:
|
|
||||||
continue
|
|
||||||
if count >= min_count:
|
|
||||||
author = authors[commentor]
|
|
||||||
users.append(
|
|
||||||
{
|
|
||||||
"login": commentor,
|
|
||||||
"count": count,
|
|
||||||
"avatarUrl": author.avatarUrl,
|
|
||||||
"url": author.url,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return users
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
|
||||||
settings = Settings() # type: ignore[reportCallIssue]
|
|
||||||
logging.info(f"Using config: {settings.model_dump_json()}")
|
|
||||||
g = Github(settings.input_token.get_secret_value())
|
|
||||||
repo = g.get_repo(settings.github_repository)
|
|
||||||
question_commentors, question_last_month_commentors, question_authors = get_experts(
|
|
||||||
settings=settings
|
|
||||||
)
|
|
||||||
contributors, pr_commentors, reviewers, pr_authors = get_contributors(
|
|
||||||
settings=settings
|
|
||||||
)
|
|
||||||
authors = {**question_authors, **pr_authors}
|
|
||||||
maintainers_logins = {"liuzicheng1987", "Urfoex"}
|
|
||||||
bot_names = {"github-actions"}
|
|
||||||
maintainers = []
|
|
||||||
for login in maintainers_logins:
|
|
||||||
user = authors[login]
|
|
||||||
maintainers.append(
|
|
||||||
{
|
|
||||||
"login": login,
|
|
||||||
"answers": question_commentors[login],
|
|
||||||
"prs": contributors[login],
|
|
||||||
"avatarUrl": user.avatarUrl,
|
|
||||||
"url": user.url,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
min_count_expert = 1
|
|
||||||
min_count_last_month = 1
|
|
||||||
min_count_contributor = 1
|
|
||||||
min_count_reviewer = 1
|
|
||||||
skip_users = maintainers_logins | bot_names
|
|
||||||
experts = get_top_users(
|
|
||||||
counter=question_commentors,
|
|
||||||
min_count=min_count_expert,
|
|
||||||
authors=authors,
|
|
||||||
skip_users=skip_users,
|
|
||||||
)
|
|
||||||
last_month_active = get_top_users(
|
|
||||||
counter=question_last_month_commentors,
|
|
||||||
min_count=min_count_last_month,
|
|
||||||
authors=authors,
|
|
||||||
skip_users=skip_users,
|
|
||||||
)
|
|
||||||
top_contributors = get_top_users(
|
|
||||||
counter=contributors,
|
|
||||||
min_count=min_count_contributor,
|
|
||||||
authors=authors,
|
|
||||||
skip_users=skip_users,
|
|
||||||
)
|
|
||||||
top_reviewers = get_top_users(
|
|
||||||
counter=reviewers,
|
|
||||||
min_count=min_count_reviewer,
|
|
||||||
authors=authors,
|
|
||||||
skip_users=skip_users,
|
|
||||||
)
|
|
||||||
|
|
||||||
people = {
|
|
||||||
"maintainers": maintainers,
|
|
||||||
"experts": experts,
|
|
||||||
"last_month_active": last_month_active,
|
|
||||||
"top_contributors": top_contributors,
|
|
||||||
"top_reviewers": top_reviewers,
|
|
||||||
}
|
|
||||||
people_path = Path("./docs/plugins/people.yml")
|
|
||||||
if not people_path.exists():
|
|
||||||
people_path.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
people_path.touch()
|
|
||||||
people_old_content = people_path.read_text(encoding="utf-8")
|
|
||||||
new_people_content = yaml.dump(
|
|
||||||
people, sort_keys=False, width=200, allow_unicode=True
|
|
||||||
)
|
|
||||||
if people_old_content == new_people_content:
|
|
||||||
logging.info("The people data hasn't changed, finishing.")
|
|
||||||
sys.exit(0)
|
|
||||||
people_path.write_text(new_people_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", "github-actions@github.com"], check=True
|
|
||||||
)
|
|
||||||
|
|
||||||
branch_name = "people-update"
|
|
||||||
logging.info(f"Creating a new branch {branch_name}")
|
|
||||||
subprocess.run(["git", "checkout", "-b", branch_name], check=True)
|
|
||||||
logging.info("Adding updated file")
|
|
||||||
subprocess.run(["git", "add", str(people_path)], check=True)
|
|
||||||
logging.info("Committing updated file")
|
|
||||||
message = "Update People information in documentation"
|
|
||||||
result = subprocess.run(["git", "commit", "-m", message], check=True)
|
|
||||||
|
|
||||||
remote_branch_exists = subprocess.run(
|
|
||||||
["git", "ls-remote", "--heads", "origin", branch_name],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
).stdout.strip()
|
|
||||||
|
|
||||||
if remote_branch_exists:
|
|
||||||
logging.info(f"Remote branch {branch_name} exists. Deleting it.")
|
|
||||||
subprocess.run(["git", "push", "origin", "--delete", branch_name], check=True)
|
|
||||||
|
|
||||||
logging.info("Pushing branch")
|
|
||||||
subprocess.run(["git", "push", "origin", branch_name], check=True)
|
|
||||||
logging.info("Creating PR")
|
|
||||||
body = """
|
|
||||||
This PR is created automatically by `update-people` GitHub workflow to update
|
|
||||||
the People information in the documentation. The workflow runs every first day
|
|
||||||
of a month.
|
|
||||||
"""
|
|
||||||
pr = repo.create_pull(
|
|
||||||
title=message,
|
|
||||||
body=body,
|
|
||||||
# base branch needs to be changed to main once
|
|
||||||
# feature branch is merged into main
|
|
||||||
base="main",
|
|
||||||
head=branch_name,
|
|
||||||
)
|
|
||||||
logging.info(f"Created PR: {pr.number}")
|
|
||||||
logging.info("Finished")
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
name: update-people
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
# - f/mkdocs
|
|
||||||
- main
|
|
||||||
schedule:
|
|
||||||
- cron: "0 12 1 * *"
|
|
||||||
workflow_dispatch: {}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
people:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: ./.github/actions/people
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
hide:
|
|
||||||
- navigation
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
# People
|
|
||||||
|
|
||||||
reflect-cpp is supported by a group of contributors and reviewers who help improve the project constantly. This page is dedicated to recognizing their efforts and contributions.
|
|
||||||
|
|
||||||
## Maintainers
|
|
||||||
|
|
||||||
The following people maintain the reflect-cpp repository on behalf of the Code17 GmbH. The main author of the library is Dr. Patrick Urbanke ([@liuzicheng1987](https://github.com/liuzicheng1987)).
|
|
||||||
|
|
||||||
{{ maintainers }}
|
|
||||||
|
|
||||||
## Contributors
|
|
||||||
|
|
||||||
Here are the users who have contributed with the pull requests that were successfully merged.
|
|
||||||
|
|
||||||
{{ top_contributors }}
|
|
||||||
|
|
||||||
## Reviewers
|
|
||||||
|
|
||||||
These users have reviewed pull requests from others, improving code quality, fixing bugs, and more.
|
|
||||||
|
|
||||||
{{ top_reviewers }}
|
|
||||||
|
|
||||||
## About the data
|
|
||||||
|
|
||||||
The information shown above is updated monthly using the Github GraphQL API.
|
|
||||||
|
|
||||||
You can find the source code for generating this data [here](https://github.com/getml/reflect-cpp/tree/main/.github/actions/people/people.py). The code is borrowed from the [pydantic project](https://github.com/pydantic/pydantic/blob/main/.github/actions/people/people.py), and modified to work with the reflect-cpp repository. Originally, the logic comes from [FastAPI](https://github.com/tiangolo/fastapi/blob/master/.github/actions/people/app/main.py).
|
|
||||||
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
from pathlib import Path
|
|
||||||
import re
|
|
||||||
from jinja2 import Template
|
|
||||||
from mkdocs.config import Config
|
|
||||||
|
|
||||||
from mkdocs.structure.files import Files
|
|
||||||
from mkdocs.structure.pages import Page
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
THIS_DIR = Path(__file__).parent
|
|
||||||
|
|
||||||
|
|
||||||
def on_page_markdown(markdown: str, page: Page, config: Config, files: Files) -> str:
|
|
||||||
"""
|
|
||||||
Called on each file after it is read and before it is converted to HTML.
|
|
||||||
"""
|
|
||||||
|
|
||||||
if md := populate_people(markdown, page):
|
|
||||||
return md
|
|
||||||
return markdown
|
|
||||||
|
|
||||||
|
|
||||||
experts_template = Template(
|
|
||||||
"""
|
|
||||||
<div class="user-list user-list-center">
|
|
||||||
{% for user in people.experts %}
|
|
||||||
<div class="user">
|
|
||||||
<a href="{{ user.url }}" target="_blank">
|
|
||||||
<div class="avatar-wrapper">
|
|
||||||
<img src="{{ user.avatarUrl }}"/>
|
|
||||||
</div>
|
|
||||||
<div class="title">@{{ user.login }}</div>
|
|
||||||
</a>
|
|
||||||
<div class="count">Questions replied: {{ user.count }}</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
most_active_users_template = Template(
|
|
||||||
"""
|
|
||||||
|
|
||||||
<div class="user-list user-list-center">
|
|
||||||
{% for user in people.last_month_active %}
|
|
||||||
<div class="user">
|
|
||||||
<a href="{{ user.url }}" target="_blank">
|
|
||||||
<div class="avatar-wrapper">
|
|
||||||
<img src="{{ user.avatarUrl }}"/>
|
|
||||||
</div>
|
|
||||||
<div class="title">@{{ user.login }}</div>
|
|
||||||
</a>
|
|
||||||
<div class="count">Questions replied: {{ user.count }}</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
top_contributors_template = Template(
|
|
||||||
"""
|
|
||||||
<div class="user-list user-list-center">
|
|
||||||
{% for user in people.top_contributors %}
|
|
||||||
<div class="user">
|
|
||||||
<a href="{{ user.url }}" target="_blank">
|
|
||||||
<div class="avatar-wrapper">
|
|
||||||
<img src="{{ user.avatarUrl }}"/>
|
|
||||||
</div>
|
|
||||||
<div class="title">@{{ user.login }}</div>
|
|
||||||
</a>
|
|
||||||
<div class="count">Contributions: {{ user.count }}</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
top_reviewers_template = Template(
|
|
||||||
"""
|
|
||||||
<div class="user-list user-list-center">
|
|
||||||
{% for user in people.top_reviewers %}
|
|
||||||
<div class="user">
|
|
||||||
<a href="{{ user.url }}" target="_blank">
|
|
||||||
<div class="avatar-wrapper">
|
|
||||||
<img src="{{ user.avatarUrl }}"/>
|
|
||||||
</div>
|
|
||||||
<div class="title">@{{ user.login }}</div>
|
|
||||||
</a>
|
|
||||||
<div class="count">Reviews: {{ user.count }}</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
maintainers_template = Template(
|
|
||||||
"""
|
|
||||||
<div class="user-list user-list-center">
|
|
||||||
{% for user in people.maintainers %}
|
|
||||||
<div class="user">
|
|
||||||
<a href="{{ user.url }}" target="_blank">
|
|
||||||
<div class="avatar-wrapper">
|
|
||||||
<img src="{{ user.avatarUrl }}"/>
|
|
||||||
</div>
|
|
||||||
<div class="title">@{{ user.login }}</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def populate_people(markdown: str, page: Page) -> str | None:
|
|
||||||
if page.file.src_uri != "people.md":
|
|
||||||
return None
|
|
||||||
|
|
||||||
# read people.yml file data
|
|
||||||
with (THIS_DIR / "people.yml").open("rb") as f:
|
|
||||||
people = yaml.load(f, Loader=yaml.FullLoader)
|
|
||||||
|
|
||||||
# Render the templates
|
|
||||||
for name, template in [
|
|
||||||
("experts", experts_template),
|
|
||||||
("most_active_users", most_active_users_template),
|
|
||||||
("top_contributors", top_contributors_template),
|
|
||||||
("top_reviewers", top_reviewers_template),
|
|
||||||
("maintainers", maintainers_template),
|
|
||||||
]:
|
|
||||||
rendered = template.render(people=people)
|
|
||||||
markdown = re.sub(f"{{{{ {name} }}}}", rendered, markdown)
|
|
||||||
|
|
||||||
return markdown
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
maintainers:
|
|
||||||
- login: Urfoex
|
|
||||||
answers: 0
|
|
||||||
prs: 4
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/1561354?v=4
|
|
||||||
url: https://github.com/Urfoex
|
|
||||||
- login: liuzicheng1987
|
|
||||||
answers: 0
|
|
||||||
prs: 78
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/19538706?u=1ca794b4e5aa9bbe50277f249e701eea86b0fdd3&v=4
|
|
||||||
url: https://github.com/liuzicheng1987
|
|
||||||
experts: []
|
|
||||||
last_month_active: []
|
|
||||||
top_contributors:
|
|
||||||
- login: hlewin
|
|
||||||
count: 6
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/25082820?v=4
|
|
||||||
url: https://github.com/hlewin
|
|
||||||
- login: ChemiCalChems
|
|
||||||
count: 4
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/9658223?u=dee2c0ee7e74b1a709d814f1944bd15ba9ca022e&v=4
|
|
||||||
url: https://github.com/ChemiCalChems
|
|
||||||
- login: grandseiken
|
|
||||||
count: 4
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/6506599?v=4
|
|
||||||
url: https://github.com/grandseiken
|
|
||||||
- login: Lazrius
|
|
||||||
count: 3
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/16494336?u=d1c359b2b9f7c1898811de4840020778dc891ea6&v=4
|
|
||||||
url: https://github.com/Lazrius
|
|
||||||
- login: Altren
|
|
||||||
count: 3
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/1607435?v=4
|
|
||||||
url: https://github.com/Altren
|
|
||||||
- login: lixin-wei
|
|
||||||
count: 2
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/19600697?u=539692f60ba009b3e2a6a66db90b1fa47be6b0bc&v=4
|
|
||||||
url: https://github.com/lixin-wei
|
|
||||||
- login: GregTheMadMonk
|
|
||||||
count: 2
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/25012039?u=2bb30375da7ba8640c208910227e028edf2c0d08&v=4
|
|
||||||
url: https://github.com/GregTheMadMonk
|
|
||||||
- login: tim-lyon
|
|
||||||
count: 2
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/45316507?u=075a847179fd6a792be9559cab7c5c951a911e5d&v=4
|
|
||||||
url: https://github.com/tim-lyon
|
|
||||||
- login: BjornSAIM
|
|
||||||
count: 2
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/171575293?v=4
|
|
||||||
url: https://github.com/BjornSAIM
|
|
||||||
- login: Harry-Chen
|
|
||||||
count: 2
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/2819727?v=4
|
|
||||||
url: https://github.com/Harry-Chen
|
|
||||||
- login: eel76
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/16246891?v=4
|
|
||||||
url: https://github.com/eel76
|
|
||||||
- login: zerolfx
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/20219056?u=cd774858edd6a4185c0634aa88fa93457fd8b017&v=4
|
|
||||||
url: https://github.com/zerolfx
|
|
||||||
- login: ecatmur
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/801922?v=4
|
|
||||||
url: https://github.com/ecatmur
|
|
||||||
- login: hazby2002
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/45712321?v=4
|
|
||||||
url: https://github.com/hazby2002
|
|
||||||
- login: melton1968
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/976548?v=4
|
|
||||||
url: https://github.com/melton1968
|
|
||||||
- login: toge
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/465629?u=fc95d16a396044be5625091463f1f89711bdc05e&v=4
|
|
||||||
url: https://github.com/toge
|
|
||||||
- login: JoshBurrell
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/8190704?v=4
|
|
||||||
url: https://github.com/JoshBurrell
|
|
||||||
- login: jkeiser
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/654882?v=4
|
|
||||||
url: https://github.com/jkeiser
|
|
||||||
- login: Knyukua
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/74075239?u=245ee84b8dc7e7a448734f78ff0c3d112ca381e4&v=4
|
|
||||||
url: https://github.com/Knyukua
|
|
||||||
- login: m-mcgowan
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/2465470?v=4
|
|
||||||
url: https://github.com/m-mcgowan
|
|
||||||
- login: RyanDraves
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/19778373?u=ea124dd87fef0431bb3acd9f22acac5571d5d0d9&v=4
|
|
||||||
url: https://github.com/RyanDraves
|
|
||||||
- login: AnsiV01
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/129291956?u=cf6d5127cc3d2803b3046b63381b0c9edb9304ec&v=4
|
|
||||||
url: https://github.com/AnsiV01
|
|
||||||
- login: dmikushin
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/5672874?u=784bed75072206acd9aaf304de65ea94b6d0c0a5&v=4
|
|
||||||
url: https://github.com/dmikushin
|
|
||||||
- login: danielmohansahu
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/17955351?v=4
|
|
||||||
url: https://github.com/danielmohansahu
|
|
||||||
- login: BestITUserEUW
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/56920372?u=819964193b010021236df083f5275bfe9a1e7b73&v=4
|
|
||||||
url: https://github.com/BestITUserEUW
|
|
||||||
- login: dcorbeil
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/8996584?u=c44b58e17208d597665b97e2e3fd774245996ae7&v=4
|
|
||||||
url: https://github.com/dcorbeil
|
|
||||||
- login: jowillianto
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/26686080?v=4
|
|
||||||
url: https://github.com/jowillianto
|
|
||||||
- login: xiaoyaodid
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/10734750?u=ae63ba0fcbc4761ec1dcae0c6a94afe14ca50589&v=4
|
|
||||||
url: https://github.com/xiaoyaodid
|
|
||||||
- login: TomCC7
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/55869557?u=050e5d34b97fab0461815215abdce175e40af951&v=4
|
|
||||||
url: https://github.com/TomCC7
|
|
||||||
- login: alxn4
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/2765645?u=af7e23999b27ec73269756356fece97425c691b4&v=4
|
|
||||||
url: https://github.com/alxn4
|
|
||||||
- login: SecondFlight
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/6700184?u=1a24c6def1a65fb96c7ebf5b95a1a589d4968b0a&v=4
|
|
||||||
url: https://github.com/SecondFlight
|
|
||||||
- login: ttamttam
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/52764?v=4
|
|
||||||
url: https://github.com/ttamttam
|
|
||||||
- login: Doekin
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/105162544?v=4
|
|
||||||
url: https://github.com/Doekin
|
|
||||||
- login: aligirayhanozbay
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/44897017?v=4
|
|
||||||
url: https://github.com/aligirayhanozbay
|
|
||||||
- login: xbrtszstk
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/176514098?v=4
|
|
||||||
url: https://github.com/xbrtszstk
|
|
||||||
top_reviewers:
|
|
||||||
- login: schaumb
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/6457941?u=542743f214f2197bd08b7b7112a2ba1b1e6e73ac&v=4
|
|
||||||
url: https://github.com/schaumb
|
|
||||||
- login: lixin-wei
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/19600697?u=539692f60ba009b3e2a6a66db90b1fa47be6b0bc&v=4
|
|
||||||
url: https://github.com/lixin-wei
|
|
||||||
- login: StephanTLavavej
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/4231088?u=fd10ba4ada8f71ecd4a6be3f4b3cb9993528babc&v=4
|
|
||||||
url: https://github.com/StephanTLavavej
|
|
||||||
- login: bryceschober
|
|
||||||
count: 1
|
|
||||||
avatarUrl: https://avatars.githubusercontent.com/u/918614?v=4
|
|
||||||
url: https://github.com/bryceschober
|
|
||||||
@@ -149,7 +149,6 @@ nav:
|
|||||||
- Maintaining backwards compatability: backwards_compatability.md
|
- Maintaining backwards compatability: backwards_compatability.md
|
||||||
- Benchmarks: benchmarks.md
|
- Benchmarks: benchmarks.md
|
||||||
- Contributing: contributing.md
|
- Contributing: contributing.md
|
||||||
- People: people.md
|
|
||||||
|
|
||||||
markdown_extensions:
|
markdown_extensions:
|
||||||
- tables
|
- tables
|
||||||
@@ -189,8 +188,3 @@ plugins:
|
|||||||
- mailto:*
|
- mailto:*
|
||||||
- 'data:image/*'
|
- 'data:image/*'
|
||||||
- '#*'
|
- '#*'
|
||||||
- https://github.com/getml/reflect-cpp/tree/main/.github/actions/people/people.py
|
|
||||||
|
|
||||||
|
|
||||||
hooks:
|
|
||||||
- docs/plugins/main.py
|
|
||||||
|
|||||||
Reference in New Issue
Block a user