lucamauri/page-to-github
Composer 安装命令:
composer require lucamauri/page-to-github
包简介
Allow the transport of page content to GitHub on page save
README 文档
README
Badges
PageToGitHub
PageToGitHub (P2G) is a MediaWiki extension that automatically uploads page content to a GitHub repository on every page save. It listens for the PageSaveComplete hook and can be scoped to a specific namespace and an optional keyword that must be present in the page body.
It was originally conceived and written by Luca Mauri for use in WikiTrek and is released as open source in case it is useful to others.
Features
- Automatically uploads wikitext content to a GitHub repository on page save
- Configurable namespace filter: only pages in the specified namespace are synced
- Optional keyword filter: only pages containing a specific string are synced
- Optional filename prefix: the keyword can be prepended to the uploaded filename
- Minor edits can be excluded from syncing
- Upload and commit messages use the wiki's i18n system
- Special page (
Special:PageToGitHub) shows the current configuration
Requirements
- PHP 8.1 or later
- MediaWiki 1.42 or later
- A GitHub personal access token with repository write permissions
- Composer for dependency management
Install
The easiest way to install the extension is using Composer: it will automatically resolve and install all dependencies.
Add the following to composer.local.json at the root of your MediaWiki installation (create the file if it does not exist):
{
"require": {
"lucamauri/page-to-github": "~2.1"
},
"extra": {
"merge-plugin": {
"include": []
}
},
"config": {}
}
Then run Composer from the root of your MediaWiki installation:
composer install --no-dev
Add the following line near the rest of the extension loading calls in LocalSettings.php:
wfLoadExtension( 'PageToGitHub' );
Then add the configuration parameters described in the Configuration section below.
Configuration
Add the following to LocalSettings.php:
$wgP2GAuthToken = 'your-github-personal-access-token'; $wgP2GIgnoreMinor = true; $wgP2GNameSpace = 'Module'; $wgP2GOwner = 'github-username-or-organisation'; $wgP2GRepo = 'repository-name'; $wgP2GKeyword = ''; // optional $wgP2GAddKeyword = false; // optional
$wgP2GAuthToken
The GitHub personal access token used to authenticate API calls. Generate one in your GitHub account under Settings > Developer settings > Personal access tokens. The token must have repository write permissions.
$wgP2GIgnoreMinor
When set to true (the default), page saves flagged as minor edits are not synced to GitHub.
$wgP2GNameSpace
Only pages belonging to this namespace are synced. Set to the namespace label as a string, e.g. 'Module'.
$wgP2GOwner
The GitHub username or organisation that owns the target repository.
$wgP2GRepo
The name of the GitHub repository where files are uploaded.
$wgP2GKeyword
An optional keyword string. When set, only pages whose content contains this string are synced. Leave empty (the default) to sync all pages in the configured namespace.
$wgP2GAddKeyword
When set to true and $wgP2GKeyword is non-empty, the keyword is prepended to the uploaded filename, e.g. a page named Foo with keyword bar is uploaded as bar-Foo.lua. Defaults to false.
Troubleshooting
To read detailed log messages, intercept the log group named PageToGitHub by adding the following to LocalSettings.php:
$wgShowExceptionDetails = true; $wgDebugLogGroups['PageToGitHub'] = "/var/log/mediawiki/PageToGitHub-{$wgDBname}.log";
Changelog
See the GitHub releases page for the full changelog.
License
This extension is released under the GNU General Public License 2.0 or later.
Maintainers
Contributors
统计信息
- 总下载量: 29
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2020-02-08