I wanna get the latest release of my theme which is stored in a private repository using pre_set_site_transient_update_themes but I failed with the download link and the authentication.
function github_fetch_user_data($githubArray)
{
$token = '<token>';
$url = 'https://api.github.com/repos/<user>/<repo>/releases';
$args = array(
'headers' => array(
'Authorization' => 'Basic ' . base64_encode('<user>' . ':' . $token)
)
);
$response = wp_remote_get($url , $args);
$body = wp_remote_retrieve_body($response);
$api_response = json_decode($body, true);
//get array of latest release
$api_detect = $api_response[0];
$githubArrayPart = $api_detect[$githubArray];
return $githubArrayPart;
}
I use this function to get a API request but when I use the zipball url with github_fetch_user_data('zipball_url'); with wordpress turns into maintanance and nothing more happens.
What is wrong with my release link or is it impossible to download a privat repository in this way?