1

I've been helping write documentation and manage the website for SuperTuxKart, an open-source racing game. The website uses MediaWiki, but we've discussed things and decided after our switch away from SourceForge hosting not to allow free account creation. However, this left us in a dilemma as to how to allow contributions to the wiki while avoiding the spam accounts that plagued the previous one.

We decided that allowing pull requests to submit content to GitHub, then deploy it to MediaWiki would work well. After some research and experimenting, I created a semi-working shell script that uses git-mediawiki to

  1. Clone the wiki
  2. Push the wiki to GitHub
  3. Fetch and merge changes from the wiki
  4. Fetch and merge changes from GitHub (though the wiki has priority in case of a merge conflict)
  5. Push to the wiki and to GitHub.

What I am looking for is a GitHub webhook service to run this script regularly (e.g. every 15 minutes) and whenever there is a commit to GitHub. It also needs some method of write access to the git repository without using my own credentials. I can't just have a script git pull updates to the server because MediaWiki pages can't be read from a normal git repository; they must be in a database.

The content of my script is below:

#!/bin/bash
#
# Auto sync script for the SuperTuxKart wiki

# Set up repo if not already done
if ! [ -d "supertuxkart.net" ]
then
    echo "Setting up repository..."

    git clone --origin wiki mediawiki::https://supertuxkart.net
    cd "supertuxkart.net"
    git remote add github https://github.com/MTres19/supertuxkart.net.git
    git push github master
fi


cd "supertuxkart.net"

git pull --rebase wiki
git pull --rebase -s recursive -X ours github master

git push wiki master
git push github master
1

Seems super complicated compared to just filtering out spam registrations, e.g. by using reCaptcha or Google login.

If you are really intent on doing this, the GitHub extension and the mw-to-git tool seem like the most mature solutions.

  • There's still not useful GitHub features like issue tracking and pull requests with plain MediaWiki. The GitHub extension is interesting but does not allow editing from either the wiki or GitHub. mw-to-git is the same as git-mediawiki; it was just moved to Git's repository. Thanks anyway for your interest. We have an auto-deploy service for the wiki skin and it looks like we may be able to use the same service for the wiki content. – user48147 Sep 11 '16 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.