f-meloni / danger-swift-coverage

Show the coverage of the modified/created files on your PRs.
MIT License
85 stars 20 forks source link

GitHub API v3 breaking change #33

Open LemonSpike opened 2 years ago

LemonSpike commented 2 years ago

I've followed the getting started guide and have successfully integrated DangerSwiftCoverage on TeamCity CI:

Dangerfile.swift

import Danger
import DangerSwiftCoverage
import Foundation

print("Generating code coverage...")
Coverage.xcodeBuildCoverage(.xcresultBundle("Build/BenchSocialNetwork-DEV.xcresult"),
                            minimumCoverage: 50,
                            excludedTargets: ["BenchSocialNetworkTests.xctest", "BenchSocialNetworkUITests.xctest"])

Command: swift run danger-swift ci

Generating code coverage...
  xcrun xccov view --report --json Build/BenchSocialNetwork-DEV.xcresult > /var/folders/jd/pzvvs8196p5cj_0j56bscv280000gp/T/file

Failing the build, there is 1 fail.
  Request failed [422]: https://api.github.com/repos/<org>/<repo>/pulls/3/reviews
  Response: {
    "message": "Unprocessable Entity",
    "errors": [
      "Pull request review thread position is invalid and Pull request review thread diff hunk can't be blank"
    ],
    "documentation_url": "https://docs.github.com/rest/reference/pulls#create-a-review-for-a-pull-request
  }

I believe this is a breaking change with the way the plugin sends requests to GitHub, since the coverage generation gave an exit code of 0.

Hope you can advise / fix asap, thanks!