-
Notifications
You must be signed in to change notification settings - Fork 253
release notes helper
Michael R. Crusoe edited this page Feb 2, 2023
·
2 revisions
To use: pip install ghapi
and update the date
below.
If you exceed the rate limit, then make a GitHub personal access token, which is a secret code used to access your account. If you don’t have one, click here to create one. You’ll be asked to enter a name – choose anything you like, for instance “ghapi”.
Example usage: python3 changelog.py > changelog.txt
#!/usr/bin/python3
from ghapi.all import GhApi
import sys
import os
github_token = '' # os.environ['GITHUB_TOKEN']
date=2021-02-04 # Only show commits after the given time.
# This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: YYYY-MM-DDTHH:MM:SSZ
# https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-commits
api = GhApi(owner='simd-everywhere', repo='simde', token=github_token)
page=0
while True:
page += 1
print(f"Page #{page}.", file=sys.stderr)
commits = api.repos.list_commits(since="2021-02-04",per_page=100, page=page)
if len(commits) < 1:
break
for commit in commits:
summary = commit.commit.message.split('\n')[0]
author = commit.author.login if commit.author else "????"
print(f"{summary} {commit.sha[0:7]} @{author}")