Skip to content

Commit

Permalink
Merge pull request #2291 from PyO3/contributors
Browse files Browse the repository at this point in the history
Add Nox session to retrieve sorted list of contributors.
  • Loading branch information
adamreichold committed Apr 11, 2022
2 parents 551db72 + 851e43b commit dc5a670
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,45 @@ def publish(session: nox.Session) -> None:
)
time.sleep(10)
session.run("cargo", "publish", external=True)


@nox.session(venv_backend="none")
def contributors(session: nox.Session) -> None:
import requests

if len(session.posargs) != 1:
raise Exception("base commit positional argument missing")

base = session.posargs[0]
page = 1

authors = set()

while True:
resp = requests.get(
f"https://api.github.com/repos/PyO3/pyo3/compare/{base}...HEAD",
params={"page": page, "per_page": 100},
)

body = resp.json()

if resp.status_code != 200:
raise Exception(
f"failed to retrieve commits: {resp.status_code} {body['message']}"
)

for commit in body["commits"]:
try:
authors.add(commit["author"]["login"])
except:
continue

if "next" in resp.links:
page += 1
else:
break

authors = sorted(list(authors))

for author in authors:
print(f"@{author}")

0 comments on commit dc5a670

Please sign in to comment.