We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cacdb94 commit 6250db7Copy full SHA for 6250db7
sh_scripts/gh_get_email.sh
@@ -0,0 +1,13 @@
1
+#!/usr/bin/env bash
2
+
3
+# Created by Sindre Sorhus
4
+# Magically retrieves a GitHub users email even though it's not publicly shown
5
6
+[ "$1" = "" ] && echo "usage: $0 <GitHub username> [<repo>]" && exit 1
7
8
+[ "$2" = "" ] && repo=$(curl "https://api.github.com/users/$1/repos?type=owner&sort=updated" -s | gsed -En 's|"name": "(.+)",|\1|p' | tr -d ' ' | head -n 1) || repo=$2
9
10
+curl "https://api.github.com/repos/$1/$repo/commits" -s | gsed -En 's|"(email\|name)": "(.+)",?|\2|p' | tr -s ' ' | paste - - | sort -u -k 1,1
11
12
+# `paste - -` remove every other linebreak
13
+# `sort -u -k1,1` only show unique lines based on first column (email)
0 commit comments