File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -21,15 +21,20 @@ const emailFetchAutomation = async () => {
21
21
for ( let i = 0 ; i < res . data . length ; i ++ ) {
22
22
if ( res . data [ i ] . type === "PushEvent" ) {
23
23
const name = "✉️ Email" ;
24
- box ( green , name , res . data [ i ] . payload . commits [ 0 ] . author . email ) ;
24
+ box ( name , res . data [ i ] . payload . commits [ 0 ] . author . email ) ;
25
25
break ;
26
26
}
27
+ if ( i === res . data . length - 1 ) {
28
+ const name = "⚠️ WARNING" ;
29
+ const msg = "No Email Found!!" ;
30
+ box ( name , msg ) ;
31
+ }
27
32
}
28
33
} )
29
34
. catch ( ( err ) => {
30
35
const name = "⚠️ WARNING" ;
31
36
const msg = "Cannot Access Email!!" ;
32
- box ( red , name , msg ) ;
37
+ box ( name , msg ) ;
33
38
} ) ;
34
39
} ;
35
40
Original file line number Diff line number Diff line change 1
1
const chalk = require ( "chalk" ) ;
2
2
3
- module . exports = ( color , name , data ) => {
3
+ module . exports = ( name , data ) => {
4
4
if ( name === "✉️ Email" ) {
5
5
console . log ( chalk . green ( " -------------------------------------------" ) ) ;
6
6
console . log ( chalk . green ( " | |" ) ) ;
7
7
console . log ( chalk . green ( ` ${ name } : ` ) + data ) ;
8
8
console . log ( chalk . green ( " | |" ) ) ;
9
9
console . log ( chalk . green ( " -------------------------------------------" ) ) ;
10
+ } else if ( data === "No Email Found!!" ) {
11
+ console . log ( chalk . red ( " -------------------------------------------" ) ) ;
12
+ console . log ( chalk . red ( " | |" ) ) ;
13
+ console . log ( chalk . red ( ` | ${ name } : ` ) + data + chalk . red ( " |" ) ) ;
14
+ console . log ( chalk . red ( " | |" ) ) ;
15
+ console . log ( chalk . red ( " -------------------------------------------" ) ) ;
10
16
} else {
11
17
console . log ( chalk . red ( " -------------------------------------------" ) ) ;
12
18
console . log ( chalk . red ( " | |" ) ) ;
You can’t perform that action at this time.
0 commit comments