public async Task <GitHubRepositoryRelease> Run( [ActivityTrigger] RepositoryConfiguration repoConfiguration, ILogger logger) { logger.LogInformation($"Started {nameof(GetLatestReleaseFromGitHubActivity)} for " + $"{ repoConfiguration.RepositoryOwner } " + $"{ repoConfiguration.RepositoryName }."); var repoRelease = new GitHubRepositoryRelease(repoConfiguration.RepositoryName); try { var releases = await _client.Repository.Release.GetAll( repoConfiguration.RepositoryOwner, repoConfiguration.RepositoryName); // A repository might not use releases yet. if (releases.Any()) { var latestRelease = releases.OrderByDescending(r => r.PublishedAt ?? r.CreatedAt).FirstOrDefault(); if (latestRelease != null) { repoRelease = MapToRepoRelease(repoConfiguration, latestRelease); } } } catch (NotFoundException) { // We're ignoring 404s for Releases since there are repositories without releases. // But we want to keep monitoring them and notify once they do have a releases. logger.LogWarning("No release information found for repository={repositoryName}", repoConfiguration.RepositoryName); } return(repoRelease); }
public GitHubRepositoryRelease Run( [ActivityTrigger] GitHubRepositoryRelease repoRelease, ILogger logger) { logger.LogInformation($"Started {nameof(SaveLatestReleaseActivity)} for " + $"{ repoRelease.RepositoryName} " + $"{ repoRelease.ReleaseName}."); return(repoRelease); }