xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
<root> / inc / wh / http / generic.inc.php (354a9f5ef8039bf31fe0e0c3aa49d0a43af052de) (914B) (mode 100644) [raw]
<?php

function rg_wh_http_generic_add_form_pre($db, &$rg)
{
	if (!isset($rg['wh']['description']))
		$rg['wh']['description'] = 'Matrix.org integration';

	$a = $rg['wh']['idata'];

	$a['itype'] = 2;
	$a['show_sign_key'] = 1;
	$a['url_example'] = 'https://my_server_dot_tld/hook.cgi?branch=##branch##';

	if (!isset($a['events']))
		$a['events'] = 'P';

	if (!isset($a['content_type']))
		$a['content_type'] = 'application/json';

	if (!isset($a['custom_body']))
		$a['custom_body'] = '{' . "\n"
			. '"channel": "#rocketgit-##branch##",' . "\n"
			. '"username": "RocketGit robot (hook ##hook_id##)",' . "\n"
			. '"text": "Repo ##repo##, branch ##branch## pushed: <##commit_url##> (ip ##ip##)",' . "\n"
			. '"icon_emoji": ":ghost:"' . "\n"
			. '}';

	$rg['wh']['idata'] = $a;
}

$cb = array(
	'add_form_pre' => 'rg_wh_http_generic_add_form_pre'
);

rg_wh_register_subtype('http', 'generic', 'Generic', $cb);

Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master