[MIRROR] Clear out some random errors in github webhook processor [MDB IGNORE] (#22027)

* Clear out some random errors in github webhook processor (#76232)

subrequests failing randomly was triggering invalid key errors later on
down the line needlessly.

* Clear out some random errors in github webhook processor

---------

Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-07-01 22:19:07 +02:00
committed by GitHub
parent bb5ef264c1
commit b46e9e7d4f

View File

@@ -239,11 +239,15 @@ function set_labels($payload, $labels, $remove) {
function tag_pr($payload, $opened) {
//get the mergeable state
$url = $payload['pull_request']['url'];
$payload['pull_request'] = json_decode(github_apisend($url), TRUE);
$new_pull_request_payload = json_decode(github_apisend($url), TRUE);
if (isset($new_pull_request_payload['id']))
$payload['pull_request'] = $new_pull_request_payload;
if($payload['pull_request']['mergeable'] == null) {
//STILL not ready. Give it a bit, then try one more time
sleep(10);
$payload['pull_request'] = json_decode(github_apisend($url), TRUE);
$new_pull_request_payload = json_decode(github_apisend($url), TRUE);
if (isset($new_pull_request_payload['id']))
$payload['pull_request'] = $new_pull_request_payload;
}
$tags = array();
@@ -645,10 +649,10 @@ $no_changelog = false;
function checkchangelog($payload) {
global $no_changelog;
if (!isset($payload['pull_request']) || !isset($payload['pull_request']['body'])) {
return;
return array();
}
if (!isset($payload['pull_request']['user']) || !isset($payload['pull_request']['user']['login'])) {
return;
return array();
}
$body = $payload['pull_request']['body'];