-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #70 Add automated contributors #73
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from github import Github | ||
from github import Auth | ||
|
||
access_token = "YOUR_ACCESS_TOKEN" | ||
|
||
auth = Auth.Token(access_token) | ||
|
||
g = Github(auth=auth) | ||
|
||
repositories = [ | ||
"openchemistry/avogadrolibs", | ||
"openchemistry/avogadroapp", | ||
"openchemistry/fragments", | ||
"openchemistry/molecules", | ||
"openchemistry/crystals", | ||
"openchemistry/avogenerators", | ||
"openchemistry/avogadro-commands", | ||
"openchemistry/avogadro-cclib", | ||
"cryos/avogadro", | ||
] | ||
|
||
unique_contributors = set() | ||
|
||
with open("contributors.md", "w") as contributors_file: | ||
for repo_name in repositories: | ||
repo = g.get_repo(repo_name) | ||
contributors = repo.get_contributors() | ||
|
||
for contributor in contributors: | ||
username = contributor.login | ||
unique_contributors.add(username) | ||
contributors_file.write(f"- {username}\n") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be great to get the full name if available .. something like:
|
||
|
||
sorted_contributors = sorted(unique_contributors) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But you already wrote the |
||
|
||
with open("credits.md", "r") as credits_file: | ||
credits_content = credits_file.read() | ||
|
||
updated_credits_content = credits_content.replace( | ||
"```{include} contributors.md```", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need to do this - the Sphinx / Myst build will include the |
||
f"```{{include}} contributors.md\n\n" + "\n".join(sorted_contributors) + "\n```" | ||
) | ||
|
||
with open("credits.md", "w") as credits_file: | ||
credits_file.write(updated_credits_content) | ||
|
||
print("Contributors have been updated in contributors.md and credits.md.") |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,3 +138,4 @@ | |
- yavgech | ||
- yuri@FreeBSD | ||
- Ondřej Čertík | ||
- Kailin Xing |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ pydata-sphinx-theme | |
sphinx-design | ||
sphinx-copybutton | ||
linkify-it-py | ||
PyGithub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cryos/avogadro repository is now closed, so I moved the contributors to a separate list already. That way we don't continue to query for the same response.