Creating PR results in 404 error? #24677
-
I’d like to create Pull Requests via API (using PyGithub as implementation). For testing, I’m making a PR inside my repository from branch Repository exists:
Branches exist:
But creating a PR results in 404:
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Hey, the first step I would try would be to swap the order of “base” and “head” to match up with the API’s example directly. Let me know if that does not work. |
Beta Was this translation helpful? Give feedback.
-
Nope, same 404 error:
|
Beta Was this translation helpful? Give feedback.
-
I think the issue may be that you aren’t authenticated. I am pretty sure you need to use a GitHub Personal Access token in order to do what you’re trying to do (since theoretically right now all you are providing is a user name, which anyone who sees’s your public repo could access and subsequently make the same API request as you). The 404 is likely saying “hey, someone is trying to access this command without telling us who they really are so we don’t want to get involved in that. Let’s tell them as little as possible (for security reasons) and return a 404”. https://developer.github.com/v3/guides/getting-started/#authentication |
Beta Was this translation helpful? Give feedback.
-
I am using personal token, I’m just not showing it. |
Beta Was this translation helpful? Give feedback.
-
It is possible your Personal Access Token does not have the correct permissions set to write to the repo. I suggest checking your current permissions. |
Beta Was this translation helpful? Give feedback.
-
Yup, had to add “access public repositories” to the token. Wish it was documented somewhere :slight_smile: |
Beta Was this translation helpful? Give feedback.
It is possible your Personal Access Token does not have the correct permissions set to write to the repo. I suggest checking your current permissions.