Skip to content

Commit c52f9b7

Browse files
authored
feature #1019 Allow fetching repo readme for a specific ref (bery)
This PR was merged into the 3.3.x-dev branch. Discussion ---------- As per Github's API it is possible to fetch a readme file for specific branch or tag https://docs.github.com/en/rest/reference/repos#get-a-repository-readme Commits ------- d73a1e0 Allow fetching repo readme for a specific ref
2 parents fd8954b + d73a1e0 commit c52f9b7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/Github/Api/Repo.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,13 @@ public function remove($username, $repository)
257257
* @param string $username the user who owns the repository
258258
* @param string $repository the name of the repository
259259
* @param string $format one of formats: "raw", "html", or "v3+json"
260+
* @param array $params additional query params like "ref" to fetch readme for branch/tag
260261
*
261262
* @return string|array the readme content
262263
*/
263-
public function readme($username, $repository, $format = 'raw')
264+
public function readme($username, $repository, $format = 'raw', $params = [])
264265
{
265-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [], [
266+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', $params, [
266267
'Accept' => "application/vnd.github.$format",
267268
]);
268269
}

0 commit comments

Comments
 (0)