utils/contrib-list.php
private static function make_github_api_request( $url, $args = array() ) {
		$headers = array(
			'Accept'     => 'application/vnd.github.v3+json',
			'User-Agent' => 'WP-CLI',
		);
		$token   = getenv( 'GITHUB_TOKEN' );
		if ( false !== $token ) {
			$headers['Authorization'] = 'token ' . $token;
		}
		$response = Utils\http_request( 'GET', $url, $args, $headers );
		if ( 200 !== $response->status_code ) {
			WP_CLI::error( sprintf( 'GitHub API returned: %s (HTTP code %d)', $response->body, $response->status_code ) );
		}
		return array( json_decode( $response->body ), $response->headers );
	}
private static function make_github_api_request( $url, $args = array() ) {
		$headers = array(
			'Accept'     => 'application/vnd.github.v3+json',
			'User-Agent' => 'WP-CLI',
		);
		$token   = getenv( 'GITHUB_TOKEN' );
		if ( false !== $token ) {
			$headers['Authorization'] = 'token ' . $token;
		}
		$response = Utils\http_request( 'GET', $url, $args, $headers );
		if ( 200 !== $response->status_code ) {
			WP_CLI::error( sprintf( 'GitHub API returned: %s (HTTP code %d)', $response->body, $response->status_code ) );
		}
		return array( json_decode( $response->body ), $response->headers );
	}
private static function make_github_api_request ( $ url , $ args = array ( ) ) { $ headers = array ( 'Accept' => 'application/vnd.github.v3+json' , 'User-Agent' => 'WP-CLI' , ) ; $ token = getenv ( 'GITHUB_TOKEN' ) ; if ( false !== $ token ) { $ headers [ 'Authorization' ] = 'token ' . $ token ; } $ response = Utils \ http_request ( 'GET' , $ url , $ args , $ headers ) ; if ( 200 !== $ response -> status_code ) { WP_CLI :: error ( sprintf ( 'GitHub API returned: %s (HTTP code %d)' , $ response -> body , $ response -> status_code ) ) ; } return array ( json_decode ( $ response -> body ) , $ response -> headers ) ; }
Make a request to the GitHub API

@param string $url
@param string $args
@return array
Make a request to the GitHub API