From f171d1fd89bf06247dc64c44e28f9d60ded4783e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 14 Feb 2020 11:50:56 +0100 Subject: [PATCH] Avoid requiring auth for the funding API access --- src/Composer/Repository/Vcs/GitHubDriver.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index 538303df1..8d2a895ab 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -194,13 +194,18 @@ class GitHubDriver extends VcsDriver } $graphql = 'query{repository(owner:"'.$this->owner.'",name:"'.$this->repository.'"){fundingLinks{platform,url}}}'; - $result = $this->remoteFilesystem->getContents($this->originUrl, 'https://api.github.com/graphql', false, [ - 'http' => [ - 'method' => 'POST', - 'content' => json_encode(['query' => $graphql]), - 'header' => ['Content-Type: application/json'], - ], - ]); + try { + $result = $this->remoteFilesystem->getContents($this->originUrl, 'https://api.github.com/graphql', false, [ + 'http' => [ + 'method' => 'POST', + 'content' => json_encode(['query' => $graphql]), + 'header' => ['Content-Type: application/json'], + ], + 'retry-auth-failure' => false, + ]); + } catch (\TransportException $e) { + return $this->fundingInfo = false; + } $result = json_decode($result, true); if (empty($result['data']['repository']['fundingLinks'])) {