Skip to content

Commit

Permalink
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 369de6b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/Github/Api/Repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,25 @@ 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 369de6b

Please sign in to comment.