Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub REST API Update Branch on a PR

Tags:

github-api

GitHub provides this feature of "Update Branch" whenever your PR is not rebased on top of master.

Is there a way to trigger this action via the REST API? I was playing around with https://developer.github.com/v3/pulls/#update-a-pull-request but nothing happened when using base: 'master'.

like image 459
Hartimer Avatar asked Oct 16 '25 10:10

Hartimer


1 Answers

It turns out, I was actually asking the wrong question. Rebasing a PR consists of merging the current HEAD of master into your branch, which can be done via

octokit.repos.merge({
    owner: pr.head.repo.owner.login,
    repo: pr.head.repo.name,
    base: pr.head.ref,
    head: 'masters_HEAD_sha1',
    commit_message: 'Merging master into this branch'
})
like image 63
Hartimer Avatar answered Oct 19 '25 09:10

Hartimer