Skip to content

Instantly share code, notes, and snippets.

@AprilSylph
Created March 7, 2022 15:45
Show Gist options
  • Save AprilSylph/eb31c78b6e54c367b88be462f87d138c to your computer and use it in GitHub Desktop.
Save AprilSylph/eb31c78b6e54c367b88be462f87d138c to your computer and use it in GitHub Desktop.
Build a co-author commit trailer from just a GitHub username
/**
* @param {string} username - GitHub username
* @returns {string} Co-author commit trailer, using the user's noreply.github.com address
*/
const getCoAuthorTrailer = async username => {
const response = await fetch(`https://api.github.com/users/${username}`);
const { id, login, name } = await response.json();
return `Co-authored-by: ${name || login} <${id}+${login}@users.noreply.github.com>`;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment