Skip to content

MediaWiki extension to automatically transfer code from wiki to GitHub

License

Notifications You must be signed in to change notification settings

lucamauri/PageToGitHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StyleCI Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads composer.lock Average time to resolve an issue Percentage of issues still open

Badges

GPLv3 License Built with Visual Studio Code Discuss on StackOverflow

PageToGitHub

PageToGitHub, P2G in short, is a MediaWiki extension to automatically transfer code from a MediaWiki wiki to GitHub. It was originally conceived and written by Luca Mauri for use in Wikitrek: it is released as open source here in case it can be useful to anybody else.

Features

Requirements

Install

Easiest way to install the extension is using Composer: it will automatically resolve all the dependencies and install them as well.

Add the require configuration as in the following example to the composer.local.json at the root of your mediawiki installation, or create the file if it does not exist yet:

{
    "require": {
        "lucamauri/page-to-github": "~2.0"
    },
    "extra": {
        "merge-plugin": {
            "include": [
            ]
        }
    },
    "config": {
    }
}

and, in a command prompt, run Composer in the root of your mediawiki installation:

composer install --no-dev

Add the following code near the rest of the extensions loading in the site's LocalSettings.php:

wfLoadExtension('PageToGitHub');

Below this line, add the configuration parameters as explained below in Configuration section.

Configuration

In the LocalSettigs.php file add:

$wgP2GAuthToken = 'GitHub-Token';
$wgP2GIgnoreMinor = true;
$wgP2GKeyword = 'Keyword';
$wgP2GAddKeyword = true;
$wgP2GNameSpace = 'Module';
$wgP2GOwner = 'Project-Or-Person';
$wgP2GRepo = 'Name-Of-Your-Repository';

$wgP2GAuthToken

The GitHub token needed to authenticate and made modification the the repository. You can generate one in your GitHub account in Settings > Developer settings > Personal access tokens

$wgP2GIgnoreMinor

If empty or set as true the revision is not pushed to GitHub if is marked as Minor

$wgP2GKeyword

An optional keyword to check into the page. When present, P2G will not upload pages if the keyword is not written in the page. If the parameter is omitted, P2G will upload all pages in the Namespace specified above.

$wgP2GAddKeyword

An optional boolean parameter: when set to true the word defined in $wgP2GKeyword is added before the name of the page to form the filename.

$wgP2GNameSpace

P2G will upload pages only belonging to the namespace spedified in this variable

$wgP2GOwner

The Person or Organization owner of the repository

$wgP2GRepo

The name of the repository where the code must be uploaded

Troubleshoot

To read detailed logging messages, you can intercept the log group named PageToGitHub: for instace with the following configuration into LocalSetting.php:

$wgShowExceptionDetails = true;
$wgDebugLogGroups['PageToGitHub'] = "/var/log/mediawiki/PageToGitHub-{$wgDBname}.log";

Documentation

License

GNU General Public License, version 3

Maintainers

Luca Mauri

Contributors

Luca Mauri

About

MediaWiki extension to automatically transfer code from wiki to GitHub

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages