Making WordPress.org


Ignore:
Timestamp:
05/22/2020 05:52:27 AM (5 years ago)
Author:
dd32
Message:

Trac: When a PR is added to a ticket, toggle the has-patch/needs-patch/needs-refresh and needs-unit-tests/has-unit-tests if it touches a tests-looking directory.

Fixes #5080.

File:
1 edited

Legend:

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

    r9898 r9900  
    5959    }
    6060
     61    $touches_tests = false;
     62    $_files = api_request(
     63        '/repos/' . $repo . '/pulls/' . intval( $pr ) . '/files?per_page=999',
     64        null,
     65        [ 'Accept: application/vnd.github.antiope-preview+json' ]
     66    );
     67    foreach ( $_files as $f ) {
     68        if ( preg_match( '!(^tests/|/tests/)!', $f->filename ) ) {
     69            $touches_tests = true;
     70            break;
     71        }
     72    }
     73
    6174    return (object) [
    6275        'repo'            => $data->base->repo->full_name,
     
    7184        'check_runs'      => $check_runs,
    7285        'reviews'         => $reviews,
     86        'touches_tests'   => $touches_tests,
    7387        'body'            => $data->body,
    7488        'user'            => (object) [
Note: See TracChangeset for help on using the changeset viewer.