简体   繁体   中英

GitHub API Merge Pull Request (Merge Button) Not Found Response

I'm trying to use the Github Merge Pull Request (Merge Button) but when I call it in either Postman or my app, it gives me a response of 404 Not Found, even though I'm know the :owner , :repo and :number is correct.

https://api.github.com/repos/:owner/:repo/pulls/:number/merge

Anybody has have this issue? and how to solve it or correctly call the API endpoint?

This is my code

const MergeOpenPR = async (owner, repo, token, number, sha) => {
  const url = `${ROOT_API_URL}/repos/${owner}/${repo}/pulls/${number}/merge?access_token=${token}`;
  let body;

  try {
    const res = await fetch(url, {
      method: 'PUT',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        sha,
      }),
    });
    body = res.json();
  } catch (error) {
    throw Error(error);
  }

  return body;
};

I am not sure if this is the case, as I haven't tried to push anything to my github repo since this morning, but I've read somewhere that GitHub is experiencing some issues and that they've set it to read-only mode, so maybe, although not entirely sure, that causes your problem, since you said you are sure your :owner , :repo and :number are correct. Maybe try again later or tomorrow.

EDIT: Heres a link for GitHub status, currently isn't working properly. https://status.github.com/messages

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM