Skip to content

Commit ceb551f

Browse files
author
Evvan Erb
committed
test find email user api
1 parent bc3d71d commit ceb551f

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

dist/index.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ function findEmailCommitAPI(apiData) {
3232
}
3333
}
3434

35+
function findEmailUserAPI(userAPIData) {
36+
if (userAPIData != null && userAPIData.data != null && userAPIData.data.email != null && userAPIData.data.email != "") {
37+
return userAPIData.data.email;
38+
}
39+
else {
40+
return null;
41+
}
42+
}
43+
3544
try {
3645
//inputs defined in action metadata file
3746
const usernameForEmail = core.getInput('github-username');
@@ -48,10 +57,7 @@ try {
4857
});
4958

5059
// Search the full html of the page for the email
51-
let emailUserpage = null;
52-
if (userAPIData != null && userAPIData.data != null && userAPIData.data.email != null && userAPIData.data.email != "") {
53-
emailUserpage = userAPIData.data.email;
54-
}
60+
let emailUserpage = findEmailUserAPI(userAPIData);
5561

5662
//email not found on page, fallback to old method to attempt email retrieval
5763
if (emailUserpage == null) {

index.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ function findEmailCommitAPI(apiData) {
2222
}
2323
}
2424

25+
function findEmailUserAPI(userAPIData) {
26+
if (userAPIData != null && userAPIData.data != null && userAPIData.data.email != null && userAPIData.data.email != "") {
27+
return userAPIData.data.email;
28+
}
29+
else {
30+
return null;
31+
}
32+
}
33+
2534
try {
2635
//inputs defined in action metadata file
2736
const usernameForEmail = core.getInput('github-username');
@@ -38,10 +47,7 @@ try {
3847
});
3948

4049
// Search the full html of the page for the email
41-
let emailUserpage = null;
42-
if (userAPIData != null && userAPIData.data != null && userAPIData.data.email != null && userAPIData.data.email != "") {
43-
emailUserpage = userAPIData.data.email;
44-
}
50+
let emailUserpage = findEmailUserAPI(userAPIData);
4551

4652
//email not found on page, fallback to old method to attempt email retrieval
4753
if (emailUserpage == null) {

0 commit comments

Comments
 (0)