cooperspencer / gickup

https://cooperspencer.github.io/gickup-documentation/
Apache License 2.0
962 stars 34 forks source link

fix: stat github wiki remotes to verify their existence #98

Closed mtoohey31 closed 2 years ago

mtoohey31 commented 2 years ago

As far as I can tell, the HasPages property for GitHub repositories doesn't indicate whether their wiki contains pages, it indicates whether GitHub Pages is enabled (though it's difficult to tell because I can't find documentation anywhere). I can't find any way to check whether the wiki is populated via the API. This fix verifies that the wiki exists by attempting to connect to it and listing the available refs. This does have a performance impact since (as #78 metions) wikis are enabled by default, so we have to attempt to list refs in almost all wikis, it doesn't take too long though. The auth code is copied from the local module's cloneRepository function.

We may be able to do the same thing for Gitea if this is an acceptable solution.

cooperspencer commented 2 years ago

Hi @mtoohey31, This is actually what I wanted to do in a next step. So that is totally fine by me

mtoohey31 commented 2 years ago

Great! Would you still like it to be in a different step of the process, or is this OK as is? My thought processes was that we should do it in this step because we only want to run this test for GitHub wikis, and it would be more complicated to check whether something is a GitHub wiki, a wiki from another provider, or simply a repo ending in .wiki further on.

cooperspencer commented 2 years ago

It is fine where it is. One thing that I just thought of is, that we can put this check in a separate module as a function and just call it for the other code hoster too. It would fit in the local or types module

mtoohey31 commented 2 years ago

Ok, I've moved the check into a function in the types package, and added checks to gitea as well. Like I mentioned in #89 though, my gitea setup is kind of irregular so it would be great if you could test whether the changes for gitea work.

cooperspencer commented 2 years ago

I ran it against my gitea instance and it worked fine. Thank you for the contribution