nerdishbynature / octokit.swift

A Swift API Client for GitHub and GitHub Enterprise
MIT License
488 stars 126 forks source link

List PRs in Private Repos #155

Closed iUsmanN closed 1 year ago

iUsmanN commented 1 year ago

Hi,

I can't seem to get the PRs in private repos and get the error:

Error Domain=com.nerdishbynature.octokit Code=404 "(null)" UserInfo={RequestKitErrorKey={ "documentation_url" = "https://docs.github.com/rest/reference/pulls#list-pull-requests"; message = "Not Found"; }}

I've given the repo scope and feel it should be working.

Any help would be appreciated! Usman

pietbrauer commented 1 year ago

I was able to get this done with the repo scope

image
do {
    let config = TokenConfiguration("your_token")
    let prs = try await Octokit(config).pullRequests(owner: "pietbrauer", repository: "my_private_repo", state: .all)
    print(prs.compactMap { $0.title })
} catch {
    print(error)
}