public static void Run([TimerTrigger("0 0 0 1 * *")] TimerInfo myTimer, ILogger log, [SendGrid] out SendGridMessage message) { var year = DateTime.Today.AddMonths(-1).Year; var month = DateTime.Today.AddMonths(-1).Month; var stringDate = $"{year}.{month.ToString("D2")}"; var configService = new ConfigurationService("WinTS"); var dataService = new ApplicationInsightService(configService); var emailService = new EmailService(configService); log.LogInformation($"WinTS: Get Application Insight data from {stringDate}"); var winTSData = dataService.GetWinTSData(year, month); log.LogInformation($"WinTS: Create Md File"); var mdText = winTSData.ToMarkdown(); log.LogInformation($"WinTS: send data mail"); message = emailService.CreateMail(mdText, stringDate); log.LogInformation($"WinTS: Finish"); }
public static async Task Run([TimerTrigger("0 0 0 1 * *")] TimerInfo myTimer, ILogger log) { CultureInfo.CurrentCulture = new CultureInfo("en-US", false); var year = DateTime.Today.AddMonths(-1).Year; var month = DateTime.Today.AddMonths(-1).Month; var stringDate = $"{year}.{month.ToString("D2")}"; var configService = new ConfigurationService("WinTS"); var dataService = new ApplicationInsightService(configService); var githubService = new GithubService(configService, log); log.LogInformation($"WinTS: Get Application Insight data from {stringDate}"); var winTSData = await dataService.GetWinTSData(year, month); log.LogInformation($"WinTS: Create Md File"); var mdText = winTSData.ToMarkdown(); log.LogInformation($"WinTS: Create Pull Request"); await githubService.CreateTelemetryPullRequest(mdText, year, month); log.LogInformation($"WinTS: Finish"); }