Making WordPress.org

Ticket #5303: github-branches.diff

File github-branches.diff, 966 bytes (added by ryelle, 4 years ago)

Allow passing in github branches, ex: https://github.com/ryelle/rmb-recipe-block/tree/try/block-json

  • cli/class-block-plugin-checker.php

     
    135135                        // https://github.com/sortabrilliant/jumbotron
    136136                        // git@github.com:sortabrilliant/jumbotron.git
    137137                        // https://github.com/sortabrilliant/jumbotron.git
    138                         //
    139                         if ( preg_match( '#^/(\w+/[^.]+)(?:\.git)?$#', $url_parts[ 'path' ], $matches ) ) {
    140                                 $url = 'https://github.com/' . $matches[1] . '.git/trunk';
     138                        if ( preg_match( '#^/(\w+/[^./]+)(?:\.git)?(.*)$#', $url_parts['path'], $matches ) ) {
     139                                if ( empty( $matches[2] ) ) {
     140                                        $url = 'https://github.com/' . $matches[1] . '.git/trunk';
     141                                } else {
     142                                        $branch = str_replace( '/tree/', '/branches/', $matches[2] );
     143                                        $url = 'https://github.com/' . $matches[1] . '.git' . $branch;
     144                                }
    141145                        } else {
    142146                                $this->record_result(
    143147                                        __FUNCTION__,