swift
swift copied to clipboard
GitHub API dataCorrupted error
Trying to get the comments on a PR.
Code:
let group = DispatchGroup()
group.enter()
_ = danger.github.api.issueComments(
owner: "foo",
repository: "bar",
number: danger.github.issue.number) { (response: Response<[Comment]>) in
switch response {
case .success(let comments):
// do stuff
case .failure(let error):
print("[ERROR]: ", error)
}
group.leave()
)
group.wait()
Issues:
- I needed to add the DispatchGroup logic otherwise it seemed to end before getting the response back from the Octokit
- I get: [ERROR]: dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 1." UserInfo={NSDebugDescription=Invalid value around character 1.})))
Not really sure how to even debug. Any idea why this is happening/how to fix?
Sorry for the delay! I totally missed this issue
The issue comment function comes from https://github.com/nerdishbynature/octokit.swift so that is probably a good starting point. The dependency was recently updated https://github.com/danger/swift/pull/417, but to doesn't seem that this change is related to the issue.