Skip to content

Commit

Permalink
Update IsForked
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Dec 18, 2024
1 parent 130ecc9 commit 8790658
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.9.0-rc</Version>
<Version>1.9.0-rc.1</Version>
</PropertyGroup>
</Project>
20 changes: 14 additions & 6 deletions ricaun.Nuke/Extensions/GitHubExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@ public static bool IsForked(this GitRepository gitRepository)
if (gitRepository is null)
return false;

var gitHubOwner = gitRepository.GetGitHubOwner();
var gitHubName = gitRepository.GetGitHubName();
var repository = GitHubTasks.GitHubClient.Repository
.Get(gitHubOwner, gitHubName)
.Result;
try
{
var gitHubOwner = gitRepository.GetGitHubOwner();
var gitHubName = gitRepository.GetGitHubName();
var repository = GitHubTasks.GitHubClient.Repository
.Get(gitHubOwner, gitHubName)
.Result;

return repository.Fork;
return repository.Fork;
}
catch
{
// Private repository is not forked.
return false;
}
}

#region GitHubUtil
Expand Down

0 comments on commit 8790658

Please sign in to comment.