Coder Social home page Coder Social logo

github-email's Introduction

github-email

Retrieve a GitHub user's email even if it's not public. Pulls info from Github user, NPM, activity commits, owned repo commit activity.

image

install

npm install --global github-email

use

github-email ghusername

Authenication Token

If the GH_EMAIL_TOKEN environment variable is not set, the script will ask the user to generate a personal access token for authentication. To do this:

  1. Visit https://github.com/settings/tokens/new?description=github-email
  2. Keep the checkboxes all unchecked
  3. Click Generate Token.
  4. Copy the token.
  5. Run this in your shell export GH_EMAIL_TOKEN=<token>
  6. Also add that line to your shell configuration (e.g. .bashrc)

github-email's People

Contributors

lesichkovm avatar paulirish avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

github-email's Issues

Emails from owned-repo recent activity false positives from forks

At the moment under Emails from owned-repo recent activity, a lot of false positives are returned simply because a user has forked a popular repo (for example to contribute something). We might want to exclude recent activity emails from popular repo's/forks.

Output truncated?

Hi, are the output or emails truncated? One of mine misses the last m of .com.

The username is 22 chars long, then there is the padding, then the email is 36 chars long.

Emails from owned-repo recent activity
*********************		    *********************@**********.co

I checked my local git clones for emails (for repo in $(all-repo); do (cd $repo && git log --format='%ae%n%aE%n%ce%n%cE'); done | sort -u) and couldn't find the .co email (the .com one is correctly listed).

Email format, silent mode, and null suppression

A few ideas to consider:

  • Make curl operate in silent mode.
  • Use jq to parse the data, rather than sed and grep.
  • Format the email address to be compatible with most e-mail clients.
  • Suppress null results.

For example:

#!/bin/bash
curl -s https://api.github.com/users/$1/events/public | \
  jq -r '.[] | select(.payload != null) | .payload | select(.commits != null) | .commits[].author | .name + " <" + .email + ">"' | \
  sort | uniq

Authenticated requests

Note that the rate limits can be exceeded. As such, perhaps it would be possible to allow configuring an API key for authenticated requests.

npm ERR! install Couldn't read dependencies

When running on home (/home/safarov/) gives the following error for Email on npm. The rest works fine.

Email on npm
npm ERR! install Couldn't read dependencies
npm ERR! Error: ENOENT, open '/home/safarov/package.json'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Linux 3.13.0-52-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/safarov
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /home/safarov/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/safarov/npm-debug.log
npm ERR! not ok code 0
/usr/local/bin/github-email: line 37: ./node_modules/.bin/npm-email: No such file or directory

OS: Ubuntu 14.04

Unable to fetch public email

I ran github-email fpg1503 but the script was not able to fetch my public github email:

Expected output:

Email on GitHub
fpg1503+spamOptOut@@@@@@@@@@gmail.com

Email on npm
fpg1503@@@@@@@gmail.com

Emails from recent commits
...

Emails from owned-repo recent activity
...

Actual Output

Email on GitHub

Email on npm
fpg1503@@@@@@@@gmail.com

Emails from recent commits
...

Emails from owned-repo recent activity
...

EDIT(paulirish): edited out all the other folks' emails.

Suppress no reply email addresses

Replicate
Run:

$ ~/bin/github-email.sh zacharysarah

Expected
Email addresses from domains such as users.noreply.github.com are not included in the results.

Actual
The noreply addresses are listed.

Workaround
Run:

$ ~/bin/github-email.sh zacharysarah | grep -v noreply

Doesn't work on Windows

I tried to run the script but it seems to not work with Windows 10.

Here is the output from my command-line (cmd):

C:\Users\bn>npm install --global github-email
C:\Program Files\nodejs\github-email -> C:\Program Files\nodejs\node_modules\github-email\github-email.sh
+ [email protected]
added 1 package from 2 contributors in 2.187s

C:\Users\bn>github-email bennyn
'"bash"' is not recognized as an internal or external command,
operable program or batch file.

The only actual logical use case for this would be malicious

The only reason people would use this is to get a Github user's email if it wasn't public. Because I'm sure that they'd check if the user in question had a public email, and if they did then they would email them whatever they wanted to say.
The same thing would happen if the Github account didn't have a public email.
First the person would check the user's account, and then they'd go to this repo to get the email.

So, really, the only use case for this software would be malicious not to mention illegal.
Furthermore, I highly doubt it actually works, considering that the software would have to hack into Github's database (I'm assuming private emails are protected the same way passwords are).

Apologies to be a bit of an asshole, but there are many reasons that a user may not want their email to be public. Letting someone get any Github user's email/s and possibly spam them or email them something rude or hateful is not something I particularly support.
I'm glad that there is a message saying to use it responsibly but, as I've pointed out, the only use case is to break that rule.

If this is a security risk on Github's side, then I would appreciate it if you would point this out to them if you haven't already.
Once again, sorry to be an asshole.

GH_EMAIL_TOKEN exists in env but it's ignored

Hey @paulirish long time no see. 👋🏼

Just took this for a spin but it appears to be ignoring the GitHub token:

$ echo $GH_EMAIL_TOKEN 
ghp_{REDACTED}
$ npx github-email zeke

Email on GitHub
   Github requires authenticated API requests to retrieve the email. See: https://git.io/vxctz
   To enable, open https://github.com/settings/tokens/new?description=github-email …
   Keep the checkboxes unchecked, hit 'Generate token', copy the token, then run this in your shell:
       export GH_EMAIL_TOKEN=<token>
   You'll also want to add that line to your shell configuration (e.g. .bashrc)

Email on npm
null

Emails from recent commits

Emails from owned-repo recent activity
$ npm i -g github-email
$ github-email zeke

Email on GitHub
   Github requires authenticated API requests to retrieve the email. See: https://git.io/vxctz
   To enable, open https://github.com/settings/tokens/new?description=github-email …
   Keep the checkboxes unchecked, hit 'Generate token', copy the token, then run this in your shell:
       export GH_EMAIL_TOKEN=<token>
   You'll also want to add that line to your shell configuration (e.g. .bashrc)

Email on npm
null

Emails from recent commits

Emails from owned-repo recent activity

Deprecation notice for authentication via URL query parameters

When using github-email I got an email from GitHub:

On (today) your personal access token (redacted) using curl/7.54.0 was used as part of a query parameter to access an endpoint through the GitHub API:

(redacted url)

Please use the Authorization HTTP header instead, as using the access_token query parameter is deprecated. If this token is being used by an app you don't have control over, be aware that it may stop working as a result of this deprecation.

Depending on your API usage, we'll be sending you this email reminder on a monthly basis for each token and User-Agent used in API calls made on your behalf.
Just one URL that was accessed with a token and User-Agent combination will be listed in the email reminder, not all.

Visit https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param for more information about suggested workarounds and removal dates.

Terminal Theme

Hi, @paulirish :

Which one 3rd party theme do u use within macOS Terminal?
It looks well, Can u tell me?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.