Skip to content

Commit

Permalink
feature #1083 Add sync a fork branch with the upstream repository
Browse files Browse the repository at this point in the history
  • Loading branch information
DAGpro committed Sep 19, 2022
1 parent 3467a34 commit 53a822f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/Github/Api/Repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,26 @@ public function branches($username, $repository, $branch = null, array $paramete
return $this->get($url, $parameters);
}


/**
* Sync a fork branch with the upstream repository.
*
* @link https://docs.github.com/en/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository
*
* @param $username
* @param $repository
* @param $branchName
*
* @return array|string
*/
public function mergeUpstream($username, $repository, $branchName = null)
{
return $this->post(
'/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/merge-upstream',
['branch' => $branchName ?? 'main']
);
}

/**
* Manage the protection of a repository branch.
*
Expand Down

0 comments on commit 53a822f

Please sign in to comment.