wait app build in heroku

pull/427/head
qkqpttgf 2021-08-23 13:18:54 +08:00 committed by GitHub
parent 8a4341cbd2
commit f81284b3f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 3 deletions

View File

@ -313,7 +313,11 @@ function updateHerokuapp($HerokuappId, $apikey, $source)
{ {
$tmp['source_blob']['url'] = $source; $tmp['source_blob']['url'] = $source;
$data = json_encode($tmp); $data = json_encode($tmp);
return HerokuAPI('POST', 'https://api.heroku.com/apps/' . $HerokuappId . '/builds', $data, $apikey); $response = HerokuAPI('POST', 'https://api.heroku.com/apps/' . $HerokuappId . '/builds', $data, $apikey);
$result = json_decode( $response['body'], true );
$result['status'] = $result['id'];
$response['body'] = json_encode($result);
return $response;
} }
function api_error($response) function api_error($response)
@ -341,6 +345,15 @@ function setConfigResponse($response)
return json_decode( $response['body'], true ); return json_decode( $response['body'], true );
} }
function WaitFunction() { function WaitFunction($buildId) {
return true; // GET /apps/{app_id_or_name}/builds/{build_id}
$response = HerokuAPI('GET', 'https://api.heroku.com/apps/' . getConfig('HerokuappId') . '/builds/' . $buildId, '', getConfig('APIKey'));
if ($response['stat']==200) {
$result = json_decode($response['body'], true);
if ($result['status']=="succeeded") return true;
else return false;
} else {
$response['body'] .= $url;
return $response;
}
} }