lucamauri/page-to-github

Allow the transport of page content to GitHub on page save

v2.0 2023-12-01 21:47 UTC

This package is auto-updated.

Last update: 2024-04-18 16:32:02 UTC


README

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

68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f392f39652f50616765546f4769744875622e737667PageToGitHub, 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