From da0d9c816ee8bccdbf7d5557cc8b229631d941c7 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 6 Nov 2017 12:37:59 -0500 Subject: [PATCH] Add more details to the build job --- build-filter.php | 20 +++++++++++++++++++- builder.php | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/build-filter.php b/build-filter.php index 569d321..a8adfa4 100644 --- a/build-filter.php +++ b/build-filter.php @@ -82,8 +82,26 @@ function runner($msg) { 'attrs' => [], ]; } else { + $client = gh_client(); + $pr_deets = $client->api('pull_request')->show( + $in->repository->owner->login, + $in->repository->name, + $in->issue->number); + $forward = [ - 'payload' => $in, + 'original_payload' => $in, + 'repo' => [ + 'owner' => $in->repository->owner->login, + 'name' => $in->repository->name, + 'full_name' => $in->repository->full_name, + 'clone_url' => $in->repository->clone_url, + ], + 'pr' => [ + 'number' => $in->issue->number, + 'target_branch' => $pr_deets['base']['ref'], + 'patch_url' => $pr_deets['patch_url'], + 'head_sha' => $pr_deets['head']['sha'], + ], 'build_default' => false, 'attrs' => $tokens, ]; diff --git a/builder.php b/builder.php index ffe3766..10f0f7d 100644 --- a/builder.php +++ b/builder.php @@ -23,7 +23,7 @@ $queueName = 'build-inputs-' . NIX_SYSTEM; function runner($msg) { echo "got a job!\n"; $body = json_decode($msg->body); - $in = $body->payload; + $in = $body->original_payload; $co = new GHE\Checkout(WORKING_DIR, "builder"); $pname = $co->checkOutRef($in->repository->full_name,