Skip to content

Commit 88e1b35

Browse files
committed
feature #1083 Add sync a fork branch with the upstream repository
1 parent 3467a34 commit 88e1b35

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/Github/Api/Repo.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,26 @@ public function branches($username, $repository, $branch = null, array $paramete
535535
return $this->get($url, $parameters);
536536
}
537537

538+
539+
/**
540+
* Sync a fork branch with the upstream repository
541+
*
542+
* @link https://docs.github.com/en/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository
543+
*
544+
* @param $username
545+
* @param $repository
546+
* @param $branchName
547+
*
548+
* @return array|string
549+
*/
550+
public function mergeUpstream($username, $repository, $branchName = null)
551+
{
552+
return $this->post(
553+
'/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/merge-upstream',
554+
['branch' => $branchName ?? 'main']
555+
);
556+
}
557+
538558
/**
539559
* Manage the protection of a repository branch.
540560
*

0 commit comments

Comments
 (0)