File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -313,13 +313,36 @@ private static void MainUpdateTask(
313313
314314 private static int GetCurrentSprint ( )
315315 {
316+ // Scheduled time for Cortesy Push
317+ var cortesyPushScheduleDay = DayOfWeek . Tuesday ;
318+ var cortesyPushUtcTime = new TimeOnly ( 8 , 30 ) ; //UTC time
319+
316320 string url = "https://whatsprintis.it" ;
317321 var httpClient = new HttpClient ( ) ;
318322 httpClient . DefaultRequestHeaders . Add ( "Accept" , "application/json" ) ;
319323
320324 string json = httpClient . GetStringAsync ( url ) . Result ;
321325 JsonDocument currentSprintData = JsonDocument . Parse ( json ) ;
322326 int currentSprint = currentSprintData . RootElement . GetProperty ( "sprint" ) . GetInt32 ( ) ;
327+ int week = currentSprintData . RootElement . GetProperty ( "week" ) . GetInt32 ( ) ;
328+
329+ if ( week == 3 ) // if it is the end of the current sprint
330+ {
331+ var nowUtc = DateTime . UtcNow ;
332+
333+ // Increase sprint number if scheduled pipeline was already triggered
334+ if ( nowUtc . DayOfWeek > cortesyPushScheduleDay )
335+ {
336+ currentSprint ++ ;
337+ }
338+ else if ( nowUtc . DayOfWeek == cortesyPushScheduleDay )
339+ {
340+ if ( TimeOnly . FromDateTime ( nowUtc ) >= cortesyPushUtcTime )
341+ {
342+ currentSprint ++ ;
343+ }
344+ }
345+ }
323346
324347 return currentSprint ;
325348 }
You can’t perform that action at this time.
0 commit comments