File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public GithubApi(IHttpService http, string? oauthToken = null)
5050
5151 public GithubRepo ? GetRepo ( GithubRef reference )
5252 => Call ( $ "repos/{ reference . Repository } ") is string s
53- ? JsonConvert . DeserializeObject < GithubRepo > ( s )
53+ ? CheckForWiki ( reference , JsonConvert . DeserializeObject < GithubRepo > ( s ) )
5454 : null ;
5555
5656 public GithubRelease ? GetLatestRelease ( GithubRef reference , bool ? usePrerelease )
@@ -98,6 +98,19 @@ public List<GithubUser> getOrgMembers(GithubUser organization)
9898 : null )
9999 ?? new List < GithubUser > ( ) ;
100100
101+ private GithubRepo ? CheckForWiki ( GithubRef reference , GithubRepo ? repo )
102+ {
103+ if ( repo is { HasWiki : true } )
104+ {
105+ repo . HasWiki = ActuallyHasWiki ( reference ) ;
106+ }
107+ return repo ;
108+ }
109+
110+ private bool ActuallyHasWiki ( GithubRef reference )
111+ // If no wiki pages have been created, the /wiki route redirects and this is null
112+ => _http . DownloadText ( new Uri ( $ "https://github.com/{ reference . Account } /{ reference . Project } /wiki") ) != null ;
113+
101114 /// <summary>
102115 /// Download a URL via the GitHubAPI.
103116 /// Will use a token if we have one.
You can’t perform that action at this time.
0 commit comments