Skip to content

Commit 1c21090

Browse files
author
Evvan Erb
committed
fixed var
1 parent ceb551f commit 1c21090

2 files changed

Lines changed: 12 additions & 24 deletions

File tree

dist/index.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@ 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-
4435
try {
4536
//inputs defined in action metadata file
4637
const usernameForEmail = core.getInput('github-username');
@@ -57,7 +48,10 @@ try {
5748
});
5849

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

6256
//email not found on page, fallback to old method to attempt email retrieval
6357
if (emailUserpage == null) {
@@ -86,8 +80,8 @@ try {
8680
});
8781
}
8882
else {
89-
console.log(`[*] Found ${usernameForEmail}\'s email: ${emailAPI}`)
90-
core.setOutput("email", emailAPI);
83+
console.log(`[*] Found ${usernameForEmail}\'s email: ${emailUserpage}`)
84+
core.setOutput("email", emailUserpage);
9185
}
9286

9387
} catch (error) {

index.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,6 @@ 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-
3425
try {
3526
//inputs defined in action metadata file
3627
const usernameForEmail = core.getInput('github-username');
@@ -47,7 +38,10 @@ try {
4738
});
4839

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

5246
//email not found on page, fallback to old method to attempt email retrieval
5347
if (emailUserpage == null) {
@@ -76,8 +70,8 @@ try {
7670
});
7771
}
7872
else {
79-
console.log(`[*] Found ${usernameForEmail}\'s email: ${emailAPI}`)
80-
core.setOutput("email", emailAPI);
73+
console.log(`[*] Found ${usernameForEmail}\'s email: ${emailUserpage}`)
74+
core.setOutput("email", emailUserpage);
8175
}
8276

8377
} catch (error) {

0 commit comments

Comments
 (0)