Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sync a fork branch with the upstream repository #1084

Merged
merged 5 commits into from
Oct 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 string $username
* @param string $repository
* @param string|null $branchName
DAGpro marked this conversation as resolved.
Show resolved Hide resolved
*
* @return array|string
*/
public function mergeUpstream($username, $repository, $branchName = null)
DAGpro marked this conversation as resolved.
Show resolved Hide resolved
{
return $this->post(
'/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/merge-upstream',
['branch' => $branchName ?? 'main']
);
}

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