Note
This project is no longer being maintained and has been archived.
Moreover, git-cliff
now includes support for obtaining GitHub username
information from commits, so I don't see the need to maintain this tool
anymore.
A simple application to find and replace emails in changelogs with GitHub
usernames.
This was developed to work with git-cliff
, but it should be easy
enough to have this working with other similar tools.
- Supports reading input from file and standard input. This allows for using the app in shell scripts.
- Persistence: Usernames are stored in an SQLite database after the first fetch, preventing repeated GitHub API calls for the same users.
As of now, you can build and install the application from source.
I'll consider publishing it to the crates.io
registry if there are a good
number of users using this application, and once I have a better name.
-
Install the Rust toolchain. Refer to their installation docs for more information.
-
Install the application using
cargo
:cargo install --git https://github.com/SanchithHegde/changelog-gh-usernames
Generate a
fine-grained GitHub personal access token
from your account settings and set the personal access token in the
GITHUB_TOKEN
environment variable before running the application.
The token need not have any additional permissions, read-only access to public
repositories should suffice since all this application performs is a user search.
export GITHUB_TOKEN="github_pat_MySecretGithubPersonalAccessToken"
Then proceed to run the application.
$ changelog-gh-usernames -h
A simple application to find and replace emails in changelogs with GitHub usernames.
Usage: changelog-gh-usernames [OPTIONS]
Options:
-f, --input-file <FILE> Input file to read the input text from
-d, --database <DATABASE_URI> Sqlite database file to persist user information. A database will be created if one doesn't already exist [default: sqlite://users.db]
-i, --in-place Flag to specify whether the output should be written back to file, or to stdout
-h, --help Print help
-V, --version Print version
changelog-gh-usernames -f /path/to/changelog.md
Optionally, you can provide the --in-place
or -i
flag to have the
application replace email addresses with GitHub usernames in place.
With git-cliff
Assuming that you have a configuration file set up for git-cliff
to write committer emails to file, you can use the application like so
(providing any more flags to either git-cliff
or changelog-gh-usernames
as
required):
git-cliff | changelog-gh-usernames
The changelog with GitHub usernames would be printed to the console. You can then choose to either pipe the output to a tool that copies to system clipboard, or redirect the output to a file, as required.
This integration is expected to be much better once the PR for integrating post-processors gets merged.
-
This will not work if the committer email address is not their primary public email address linked to their GitHub account, since the GitHub API does not return any results in this case. This is also the case if the user has changed their primary public email address on their GitHub account since they made the commit.
A possible temporary solution to this is to manually insert their details in the database if their GitHub username is known.
Feel free to open issues or discussions if you'd like to provide feedback or suggestions.
Suggestions for a better name are also welcome!
Dual licensed under Apache 2.0 or MIT at your option.
See the LICENSE-APACHE and LICENSE-MIT files for license details.