Making WordPress.org


Ignore:
Timestamp:
05/22/2020 05:12:41 AM (6 years ago)
Author:
dd32
Message:

Trac: Attempt to include PR Review status in the PR status on trac.

Fixes #5052.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/functions.php

    r9897 r9898  
    4444        }
    4545
     46        $_reviews = api_request(
     47                '/repos/' . $repo . '/pulls/' . intval( $pr ) . '/reviews',
     48                null,
     49                [ 'Accept: application/vnd.github.antiope-preview+json' ]
     50        );
     51        $reviews = [];
     52        foreach ( $_reviews as $r ) {
     53                if (
     54                        in_array( $r->state, [ 'CHANGES_REQUESTED', 'APPROVED' ] ) &&
     55                        ! in_array( $r->user->login, $reviews[ $r->state ] ?? [], true )
     56                ) {
     57                        $reviews[ $r->state ][] = $r->user->login;
     58                }
     59        }
     60
    4661        return (object) [
    4762                'repo'            => $data->base->repo->full_name,
     
    5570                'mergeable_state' => $data->mergeable_state,
    5671                'check_runs'      => $check_runs,
     72                'reviews'         => $reviews,
    5773                'body'            => $data->body,
    5874                'user'            => (object) [
Note: See TracChangeset for help on using the changeset viewer.