gr2m / helpdesk

Answering all your GitHub API/automation questions live on Twitch
https://twitch.tv/gregorcodes
Creative Commons Zero v1.0 Universal
22 stars 11 forks source link

octokit-plugin-create-pull-request force appends "repos" into url #65

Closed samusiu closed 4 months ago

samusiu commented 4 months ago

Please avoid duplicates

Description

Hi, I'm kind of new to front end and have been trying to use octokit-plugin-create-pull-request to create PRs, however, the request fails because the logic hard codes "repos" into the url when my github url doesn't include it. FYI I'm using an enterprise github so I've replaced the actual owner and repo names with dummies. For example, for this request,

      .createPullRequest({
        owner: "sam",
        repo: "testrepo",
        title: "test github api",
        body: "test github api",
        head: "test github api PR",
        base: "main"

I get this error

       GET https://github.com/repos/sam/testrepo net::ERR_FAILED

because my actual url would be https://github.com/sam/testrepo Is it possible to not add that "repos" into the url?

Thank you!

Would you be interested in joining the show?

gr2m commented 4 months ago

it would be better to open an issue on https://github.com/gr2m/octokit-plugin-create-pull-request if you found a bug.

In this case, the /repos part is correct, because this is how the API work. This repo's public URL is https://github.com/gr2m/helpdesk. But the API endpoint is https://api.github.com/repos/gr2m/helpdesk

samusiu commented 4 months ago

ahh yeah I realized that, looks like the request is just failing elsewhere. Sorry for the inconvenience! I'm still getting familiar with the API

gr2m commented 4 months ago

no problem, good luck!