Skip to content

Create simple web-app that creates GitHub author by username #2

Description

@Gummibeer

In open-source it's sometimes great to add someone else as author to a commit.
As it's nearly impossible to get the real email by the other user we can use the GitHub generated email address.
This email address isn't public - but it follows always the same structure.
Using the GitHub API we can create this by the username.

Somewhen back I've created a simple node.js CLI file that does the job.
But a simple web app that has an input and generates the same output would be great.

const fetch = require('node-fetch');

const username = process.argv.slice(-1).pop();

fetch(`https://api.github.com/users/${username}`, {
    method: 'GET',
    headers: {
        'user-agent': 'GitHub-Author-Generator',
    }
})
    .then(res => res.json())
    .then(json => `${json.name} <${json.id}+${json.login}@users.noreply.github.com>`)
    .then(console.log);

This script doesn't require any access token - so it should be possible to do the call in the users browser, so we can host it statically without any backend.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions