Fix poster for new reply syntax

This commit is contained in:
Graham Christensen 2017-11-10 19:54:09 -05:00
parent 83d4132f36
commit 1783d3f583
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C

View file

@ -17,26 +17,25 @@ list($queueName, , ) = $channel->queue_declare('build-results',
function runner($msg) {
$body = json_decode($msg->body);
$in = $body->payload;
$num = $in->issue->number;
$num = $body->pr->number;
if ($body->success) {
echo "yay! $num passed!\n";
} else {
echo "Yikes, $num failed\n";
}
reply_to_issue($in, implode("\n", $body->output), $body->success, $body->system);
reply_to_issue($body, implode("\n", $body->output), $body->success, $body->system);
var_dump($body->success);
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
}
function reply_to_issue($issue, $output, $success, $system) {
$num = $issue->issue->number;
$owner = $issue->repository->owner->login;
$repo = $issue->repository->name;
function reply_to_issue($body, $output, $success, $system) {
$num = $body->pr->number;
$owner = $body->repo->owner;
$repo = $body->repo->name;
$event = $success ? 'APPROVE' : 'COMMENT';
$passfail = $success ? "Success" : "Failure";
@ -53,8 +52,8 @@ function reply_to_issue($issue, $output, $success, $system) {
$event = 'COMMENT';
}
$sha = $pr['head']['sha'];
echo "Latest sha: $sha\n";
$sha = $body->pr->head_sha;
echo "On sha: $sha\n";
echo "Body:\n";
echo $output;
echo "\n\n";