Skip to content

Commit

Permalink
treat NotFoundException as archived
Browse files Browse the repository at this point in the history
  • Loading branch information
dabutvin committed Dec 24, 2018
1 parent 93e7752 commit 628b395
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions CompressImagesFunction/RepoChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ public async Task<bool> IsArchived(GitHubClientParameters parameters)
var githubClient = new GitHubClient(
new ProductHeaderValue("ImgBot"), inMemoryCredentialStore);

var repo = await githubClient.Repository.Get(
parameters.RepoOwner, parameters.RepoName);

return repo.Archived;
try
{
var repo = await githubClient.Repository.Get(
parameters.RepoOwner, parameters.RepoName);
return repo.Archived;
}
catch (NotFoundException)
{
return true; // not found can be treated the same as archived
}
}
}
}

0 comments on commit 628b395

Please sign in to comment.