35 lines
847 B
PHP
35 lines
847 B
PHP
<?php
|
|
|
|
function submitToGitea($title,$body) {
|
|
|
|
// Get API Key for git.fjla.uk
|
|
require '/srv/php-keys/athena/gitea.php';
|
|
|
|
// Set httpHeaders
|
|
$httpHeaders = array(
|
|
"accept: application/json",
|
|
$giteaKey,
|
|
"Content-Type: application/json"
|
|
);
|
|
|
|
// Prepare the request
|
|
$rawData = array(
|
|
'body' => $body,
|
|
'title' => $subject
|
|
);
|
|
|
|
$preparedData = json_encode($rawData);
|
|
|
|
// Prepare CURL
|
|
$curlConnection = curl_init('https://git.fjla.uk/api/v1/repos/fred.boniface/athena.fb-infra.uk/issues');
|
|
curl_setopt($curlConnection, CURLOPT_POSTFIELDS, $preparedData);
|
|
curl_setopt($curlConnection, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($curlConnection, CURLOPT_HTTPHEADER, $httpHeaders);
|
|
|
|
// Get response and exit CURL
|
|
$response = curl_exec($curlConnection);
|
|
curl_close($curlConnection);
|
|
|
|
return $response;
|
|
}
|