Skip to content

Commit 1a79280

Browse files
author
Evvan Erb
authored
Merge pull request #3 from evvanErb/loginAndRequest
Token Auth as Primary Retreival Method
2 parents 8e7f3c3 + e7b2f31 commit 1a79280

File tree

9 files changed

+13007
-4153
lines changed

9 files changed

+13007
-4153
lines changed

.github/workflows/automated_testing.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ jobs:
1010
get_easy_email:
1111
runs-on: ubuntu-latest
1212
name: Get an easy to find email
13+
steps:
14+
- name: get easy email
15+
id: get_easy_email_test
16+
uses: evvanErb/get-github-email-by-username-action@main
17+
with:
18+
github-username: 'evvanErb'
19+
token: ${{ secrets.BOT_TOKEN }}
20+
21+
- name: Echo the output email
22+
run: echo "The email is ${{ steps.get_easy_email_test.outputs.email }}"
23+
24+
get_easy_email_bad_token:
25+
runs-on: ubuntu-latest
26+
name: Get an easy to find email bad token
1327
steps:
1428
- name: get easy email
1529
id: get_easy_email_test
@@ -29,6 +43,21 @@ jobs:
2943
uses: evvanErb/get-github-email-by-username-action@main
3044
with:
3145
github-username: 'highly0'
46+
token: ${{ secrets.BOT_TOKEN }}
47+
48+
- name: Echo the output email
49+
run: echo "The email is ${{ steps.get_email_after_bot_test.outputs.email }}"
50+
51+
get_email_only_userpage_no_events:
52+
runs-on: ubuntu-latest
53+
name: Get an email listed on a user's page but not in events
54+
steps:
55+
- name: get email after bot
56+
id: get_email_after_bot_test
57+
uses: evvanErb/get-github-email-by-username-action@main
58+
with:
59+
github-username: 'jaronson13'
60+
token: ${{ secrets.BOT_TOKEN }}
3261

3362
- name: Echo the output email
3463
run: echo "The email is ${{ steps.get_email_after_bot_test.outputs.email }}"
@@ -42,6 +71,7 @@ jobs:
4271
uses: evvanErb/get-github-email-by-username-action@main
4372
with:
4473
github-username: 'hstought'
74+
token: ${{ secrets.BOT_TOKEN }}
4575

4676
- name: Echo the output email (Should not run)
4777
run: echo "The email is ${{ steps.fail_bad_email_test.outputs.email }}"
@@ -55,6 +85,7 @@ jobs:
5585
uses: evvanErb/get-github-email-by-username-action@main
5686
with:
5787
github-username: 'evvvvvaaannnnneeerrrbbb'
88+
token: ${{ secrets.BOT_TOKEN }}
5889

5990
- name: Echo the output email (Should not run)
6091
run: echo "The email is ${{ steps.get_email_after_bot_test.outputs.email }}"

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ GitHub Actions Plugin to get a GitHub user's email based on their username
33

44
## Usage
55

6-
Takes in a username as a required input, queries Github's API to find all public event related to a user, then finds their email in the API response and returns it. The user must have made a commit to a public repo during the current calendar year and have their email exposed to the public in their settings.
6+
Takes in a username as a required input and a personal access token as an optional input. If a personal access token (does not matter whose) is provided, it queries Github's Users API to find the public info available for the provided username in order to get their email. If this fails, or no auth token is provided, it attempts to search all public event related to a user, then tries to find their email in the API response and return it (fallback / no auth token method). For the fallback / no auth token method, a user must have made a commit to a public repo during the current calendar year and have their email exposed to the public in their settings.
77

88
## Example
99
```
@@ -21,6 +21,7 @@ jobs:
2121
uses: evvanErb/get-github-email-by-username-action@v1.25
2222
with:
2323
github-username: 'evvanErb' # This is the input username
24+
token: 'token' # This is an optional input of a PAT to use a more reliable way to get a user's email
2425
2526
# Use the output from the `test` step
2627
- name: Print the found email

action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
name: 'Get GitHub Email from Username'
22
description: 'Get a GitHub users email address'
33
inputs:
4+
45
github-username: # id of input
56
description: 'Username to get email for'
67
required: true
78
default: 'evvanErb'
9+
10+
token: # id of input
11+
description: 'Token to login to get email'
12+
required: false
13+
default: ''
14+
815
outputs:
916
email: # id of output
1017
description: 'The email found'

dist/303.index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ __webpack_require__.r(__webpack_exports__);
1010
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1111
/* harmony export */ "toFormData": () => (/* binding */ toFormData)
1212
/* harmony export */ });
13-
/* harmony import */ var fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(870);
14-
/* harmony import */ var formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(253);
13+
/* harmony import */ var fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7870);
14+
/* harmony import */ var formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2253);
1515

1616

1717

0 commit comments

Comments
 (0)