Decathlon / wiki-page-creator-action

Create a GitHub wiki page based on the provided markdown file
Apache License 2.0
94 stars 20 forks source link

Create the wiki if it was not initialised before #9

Open an0rak-dev opened 4 years ago

an0rak-dev commented 4 years ago

Hi !

Here is (IMHO) an interesting feature request for your action : Add the ability to initiate the Repo's wiki if there is no wiki in it.

Actually, when you use your action on a repo with no wiki initialised, you'll get the following error : remote error: access denied or repository not exported: /c/nw/cc/50/e1/252169893/XXXXXXXX.wiki.git

It could be great to check this error and create the wiki (with an API call or another action for example) to initiate the wiki then retry to run the git pull/push of the wiki.

mmornati commented 4 years ago

Sorry mate... the Covid19 period brings us working hard on many other kinds of stuff (and the GitHub notifications page for some reason did not show me what you wrote here). Anyway, I'm not sure how we can create a wiki via the GitHub API but it seems a very interesting feature. I will check the GitHub documentation for this.

What I can propose (if it is possible for sure), and let me know if it is ok for you, is to make the first call to check if the wiki is initialized on the target Repo, in this case, if you asked (with an environment variable) for an initialization we can activate it just before the push.

docker run -e INITIALIZE_EMPTY_WIKI=true ...

we can consider even this property true by default, and you can just put it to false for safety reasons.

Do you know @an0rak-dev if the Wiki is accessible via API or whatever? When I checked at the beginning I want to do it via API and the only way I found was pushing pages using the git command.

an0rak-dev commented 4 years ago

No problem for the delay, I can clearly understand that ! 😉

I've read the GitHub API and unfortunately, I can't found any API for wikis... Except the one to enable/disable it in the repository settings, but this API will not create the Wiki's repo...

I can extract the request made by the browser will creating a wiki but (a POST on $REPO_URL/wiki) the form contains the following fields :

And I'm afraid that we can't find the authenticity_token and timestamp_secret infos in the Actions 😞