Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Pull request review thread line must be part of the diff #48

Closed
justinchuby opened this issue Oct 10, 2024 · 3 comments · Fixed by #49
Closed

Error: Pull request review thread line must be part of the diff #48

justinchuby opened this issue Oct 10, 2024 · 3 comments · Fixed by #49

Comments

@justinchuby
Copy link

I am testing the workflow at microsoft/onnxruntime#22389, when I get the following error message from the workflow:

file:///home/runner/work/_actions/parkerbxyz/suggest-changes/v1/dist/index.js:53837
      const error = new RequestError(toErrorMessage(data), status, {
                    ^

RequestError [HttpError]: Unprocessable Entity: "Pull request review thread line must be part of the diff, Pull request review thread start line must be part of the same hunk as the line., and Pull request review thread diff hunk can't be blank" - https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request
    at file:///home/runner/work/_actions/parkerbxyz/suggest-changes/v1/dist/index.js:53837:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/runner/work/_actions/parkerbxyz/suggest-changes/v1/dist/index.js:53154:3 {
  status: 422,
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/microsoft/onnxruntime/pulls/22389/reviews',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'suggest-changes octokit-core.js/6.1.2 Node.js/20.[13](https://github.com/microsoft/onnxruntime/actions/runs/11277254545/job/31362981465?pr=22389#step:7:14).1 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"event":"REQUEST_CHANGES","body":"You can commit the suggested changes from lintrunner.","comments":[{"path":"onnxruntime/core/framework/copy.cc","start_line":13,"line":16,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\n       i--) {\\n    strides[i - 1] = running_size;\\n````"},{"path":"onnxruntime/core/framework/copy.cc","start_line":70,"line":139,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\n````"},{"path":"tools/python/fix_long_lines.py","start_line":13,"line":18,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n_log = logger.get_logger(\\"fix_long_lines\\", logging.INFO)\\n````"}]}',
    request: {
      fetch: [AsyncFunction: customFetch],
      hook: [Function: bound bound register]
    }
  },
  response: {
    url: 'https://api.github.com/repos/microsoft/onnxruntime/pulls/22389/reviews',
    status: 422,
    headers: {
      'access-control-allow-origin': '*',
      'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
      'content-length': '358',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Thu, 10 Oct 2024 15:35:18 GMT',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'github.com',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-accepted-github-permissions': 'pull_requests=write',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'x-github-api-version-selected': '2022-11-28',
      'x-github-media-type': 'github.v3; format=json',
      'x-github-request-id': 'EC40:1F1968:55BBA5:A6389C:6707F435',
      'x-ratelimit-limit': '15000',
      'x-ratelimit-remaining': '[14](https://github.com/microsoft/onnxruntime/actions/runs/11277254545/job/31362981465?pr=22389#step:7:15)932',
      'x-ratelimit-reset': '1728576552',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '68',
      'x-xss-protection': '0'
    },
    data: {
      message: 'Unprocessable Entity',
      errors: [
        "Pull request review thread line must be part of the diff, Pull request review thread start line must be part of the same hunk as the line., and Pull request review thread diff hunk can't be blank"
      ],
      documentation_url: 'https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request',
      status: '422'
    }
  }
}
@parkerbxyz
Copy link
Owner

parkerbxyz commented Oct 10, 2024

Thanks for reporting this, @justinchuby. I just released v1.0.8 with some bug fixes. Can you give it another try and let me know if you get the same error? If you can run the workflow with debugging enabled and provide the debugging output here, that would also be helpful. I wonder if #28 was never actually fixed.

@justinchuby
Copy link
Author

It works now, thanks! GitHub doesn’t allow a suggestion on deleted lines, so some suggestions are not commitable. I wonder if there is a way for GitHub to relax the limitation.

@parkerbxyz parkerbxyz linked a pull request Oct 11, 2024 that will close this issue
@parkerbxyz
Copy link
Owner

parkerbxyz commented Oct 11, 2024

GitHub doesn’t allow a suggestion on deleted lines, so some suggestions are not commitable.

Suggestions can't be made on deleted lines of a pull request diff because the deleted lines no longer exist on the branch where the suggestion is being made. This action shouldn't be suggesting changes on deleted lines. I'll open a new issue for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants