1
1
const PAT_TOKEN = process . env . PAT_TOKEN ;
2
2
const [ REPO_OWNER , REPO_NAME ] = process . env . GITHUB_REPOSITORY . split ( "/" ) ;
3
- const today = new Date ( ) . toISOString ( ) . split ( "T" ) [ 0 ] ;
4
3
5
4
async function getIssues ( ) {
6
5
const query =
@@ -66,8 +65,8 @@ async function getIssues() {
66
65
id : item . id ,
67
66
title : item . content . title ,
68
67
number : item . content . number ,
69
- start : start . date ,
70
- end : end . date ,
68
+ start : start ? .date ,
69
+ end : end ? .date ,
71
70
} ) ;
72
71
} ) ;
73
72
@@ -86,8 +85,10 @@ async function addComment(issueNumber, comment) {
86
85
} ) ;
87
86
}
88
87
89
- function isDateBetween ( date , start , end ) {
90
- const currentDate = new Date ( date ) ;
88
+ function isTodayBetween ( start , end ) {
89
+ if ( ! start || ! end ) return false ;
90
+
91
+ const currentDate = new Date ( ) . toISOString ( ) . split ( "T" ) [ 0 ] ;
91
92
const startDate = new Date ( start ) ;
92
93
const endDate = new Date ( end ) ;
93
94
@@ -103,7 +104,7 @@ async function reminder() {
103
104
}
104
105
105
106
for ( const issue of issues ) {
106
- if ( ! isDateBetween ( today , issue . start , issue . end ) ) {
107
+ if ( ! isTodayBetween ( issue . start , issue . end ) ) {
107
108
console . log ( `No comments for issue #${ issue . number } : ${ issue . title } ` ) ;
108
109
continue ;
109
110
}
0 commit comments