octokit / octokit.js

The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.
MIT License
7.03k stars 1.03k forks source link

Updating a stale pull request head branch with base branch (from fork) #1500

Closed galdinorosas closed 4 years ago

galdinorosas commented 5 years ago
  1. I am trying to update my pull request head branch with the latest changes from the base branch; the head branch repo was forked from the base branch repo.

I was told from github developers to use "/repos/:owner/:repo/merges" to update a stale pull request head branch. This is my request params i send:

{
repo: my forked repo,
owner: myself,
base: pull request head branch name,
head: pull request base branch latest sha
}

The error I am getting is a 404 Head Does Not Exist but I know the base branch contains this latest sha. The crazy thing is that this error seems intermittent. Should I be updating my stale PR head branches in a different way?

Please let me know.

Thank You

{ method: 'POST',
  baseUrl: 'https://gecgithub01.walmart.com/api/v3',
  headers: 
   { accept: 'application/vnd.github.v3+json',
     'user-agent': 'spectrum-github-automerger octokit.js/16.33.0 Node.js/8.12.0 (Linux 3.10; x64)',
     authorization: 'token #######################' },
  mediaType: { format: '', previews: [] },
  request: 
   { hook: [Function: bound bound register],
     validate: 
      { base: [Object],
        commit_message: [Object],
        head: [Object],
        owner: [Object],
        repo: [Object] } },
  url: '/repos/:owner/:repo/merges',
  owner: 'g0r009y',
  repo: 'spectrum',
  base: 'test2',
  head: '023d8a409e090d1cbf336c1d86dd29d705235755' }

Proof that the base pull request branch has the latest sha:

Screen Shot 2019-10-09 at 4 36 14 PM
gr2m commented 5 years ago

hard to tell what is wrong. But maybe you can look in how it's solved in https://github.com/tibdex/github-rebase? It's using @octokit/rest internally

galdinorosas commented 5 years ago

I appreciate the link, i'll look into it.

From your own personal opinion, what octokit API would you suggest to update my local pull request head branch with a forked upstream base branch?

Thanks

On Oct 9, 2019, at 16:42, Gregor Martynus notifications@github.com wrote:

hard to tell what is wrong. But maybe you can look in how it's solved in https://github.com/tibdex/github-rebase? It's using @octokit/rest internally

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

gr2m commented 5 years ago

@galdinorosas I'm very sorry I missed your follow up question!

Did you figure it out? I don't think that there is a single API call to make that work, it would be a bit more complex. But it sounds like a problem others might run into, maybe it would be worth to create a plugin?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.