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

RequestError: Unprocessable Entity: Pull request review thread line must be part of the diff #28

Open
boozook opened this issue Apr 13, 2024 · 0 comments

Comments

@boozook
Copy link

boozook commented Apr 13, 2024

Action version: 1.0.4
Usage: here
Error: here

file:///home/runner/work/_actions/parkerbxyz/suggest-changes/v1.0.4/dist/index.js:33353
      const error = new import_request_error.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"
    at file:///home/runner/work/_actions/parkerbxyz/suggest-changes/v1.0.4/dist/index.js:33353:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/runner/work/_actions/parkerbxyz/suggest-changes/v1.0.4/dist/index.js:57187:3
Full error log
file:///home/runner/work/_actions/parkerbxyz/suggest-changes/v1.0.4/dist/index.js:33353
      const error = new import_request_error.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"
    at file:///home/runner/work/_actions/parkerbxyz/suggest-changes/v1.0.4/dist/index.js:33353:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/runner/work/_actions/parkerbxyz/suggest-changes/v1.0.4/dist/index.js:57187:3 {
  status: 422,
  response: {
    url: 'https://api.github.com/repos/boozook/playdate/pulls/294/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': '343',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Sat, 13 Apr 2024 11:00:59 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': '0CC0:25FEDB:1A4E7C7:299BB81:661A65EA',
      'x-ratelimit-limit': '5000',
      'x-ratelimit-remaining': '4995',
      'x-ratelimit-reset': '1713009635',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '5',
      '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'
    }
  },
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/boozook/playdate/pulls/294/reviews',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'suggest-changes octokit-core.js/5.0.2 Node.js/20.8.1 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"event":"REQUEST_CHANGES","body":"","comments":[{"path":"support/bindgen-cfg/src/lib.rs","start_line":384,"line":390,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\t\\tif var(\\"TARGET\\")? == \\"thumbv7em-none-eabihf\\" {\\n\\t\\t\\tOk(Self::Playdate)\\n\\t\\t} else {\\n\\t\\t\\tuse core::ffi::c_int;\\n\\t\\t\\tlet ptr = var(\\"CARGO_CFG_TARGET_POINTER_WIDTH\\")?;\\n\\t\\t\\tOk(Self::Other { ptr,\\n````"},{"path":"support/bindgen/src/gen/docs/gen.rs","start_line":21,"line":38,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\nfn find_struct<\'t>(items: &\'t [Cell<Item>], name: &str) -> Option<&\'t mut ItemStruct> {\\n\\titems.iter().find_map(|item| {\\n\\t\\t            match unsafe { item.as_ptr().as_mut() }.expect(\\"cell is null, impossible\\") {\\n\\t\\t\\t            syn::Item::Struct(entry) if entry.ident == name => Some(entry),\\n\\t\\t               _ => None,\\n\\t\\t            }\\n\\t            })\\n}\\n\\n\\nfn walk_struct(items: &[Cell<Item>],\\n               this: Option<&str>,\\n               structure: &mut ItemStruct,\\n               docs: &HashMap<String, String>) {\\n\\tlet prefix = this.map(|s| format!(\\"{s}.\\")).unwrap_or(\\"\\".to_owned());\\n\\tfor field in structure.fields.iter_mut() {\\n\\t\\tlet field_name = field.ident.as_ref().expect(\\"field name\\");\\n````"},{"path":"support/bindgen/src/gen/docs/gen.rs","start_line":56,"line":77,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\t\\t\\t\\tif let Some(ident) = path.path.get_ident() {\\n\\t\\t\\t\\t\\tunimplemented!(\\"unexpected struct: \'{}\'\\", quote::quote!(#ident))\\n\\t\\t\\t\\t} else if let Some(ty) = extract_type_from_option(&field.ty) {\\n\\t\\t\\t\\t\\tmatch ty {\\n\\t\\t\\t\\t\\t\\tType::BareFn(_) => {\\n\\t\\t\\t\\t\\t\\t\\tlet key = format!(\\"{prefix}{field_name}\\");\\n\\t\\t\\t\\t\\t\\t\\tif let Some(doc) = docs.get(&key) {\\n\\t\\t\\t\\t\\t\\t\\t\\tlet attr: syn::Attribute = syn::parse_quote! { #[doc = #doc] };\\n\\t\\t\\t\\t\\t\\t\\t\\tfield.attrs.push(attr);\\n\\t\\t\\t\\t\\t\\t\\t} else {\\n\\t\\t\\t\\t\\t\\t\\t\\t#[cfg(feature = \\"log\\")]\\n\\t\\t\\t\\t\\t\\t\\t\\tprintln!(\\"cargo:warning=Doc not found for \'{key}\'\\");\\n\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t\\t_ => unimplemented!(\\"unexpected ty: \'{}\'\\", quote::quote!(#ty)),\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t} else {\\n\\t\\t\\t\\t\\tunimplemented!(\\"unexpected ty: \'{}\'\\", quote::quote!(#&path))\\n\\t\\t\\t\\t}\\n\\t\\t\\t},\\n\\n\\t\\t\\tty => {\\n````"},{"path":"support/bindgen/src/gen/docs/gen.rs","start_line":98,"line":110,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\t}\\n\\n\\tfn extract_option_segment(path: &Path) -> Option<&PathSegment> {\\n\\t\\tlet idents_of_path = path.segments.iter().fold(String::new(), |mut acc, v| {\\n\\t\\t\\t                                         acc.push_str(&v.ident.to_string());\\n\\t\\t\\t                                         acc.push(\'|\');\\n\\t\\t\\t                                         acc\\n\\t\\t                                         });\\n\\t\\tvec![\\"Option|\\", \\"std|option|Option|\\", \\"core|option|Option|\\"].into_iter()\\n\\t\\t                                                            .find(|s| &idents_of_path == *s)\\n\\t\\t                                                            .and_then(|_| path.segments.last())\\n````"},{"path":"support/bindgen/src/gen/docs/parser.rs","start_line":65,"line":74,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\t\\t\\t\\tlet attrs = attrs.borrow();\\n\\t\\t\\t\\tlet attr = attrs.iter()\\n\\t\\t\\t\\t                .find(|attr| attr.name.local == *\\"id\\" && attr.value.starts_with(\\"f-\\"));\\n\\t\\t\\t\\tattr.map(|attr| {\\n\\t\\t\\t\\t\\t    attr.value\\n\\t\\t\\t\\t\\t        .strip_prefix(\\"f-\\")\\n\\t\\t\\t\\t\\t        .expect(\\"prefix \'f-\' must be there\\")\\n\\t\\t\\t\\t\\t        .to_string()\\n\\t\\t\\t\\t    })\\n\\t\\t\\t} else {\\n\\t\\t\\t\\tNone\\n\\t\\t\\t};\\n````"},{"path":"support/bindgen/src/gen/docs/parser.rs","start_line":146,"line":152,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\t\\timpl TagHandlerFactory for PreAsIsTagFactory {\\n\\t\\t\\tfn instantiate(&self) -> Box<dyn TagHandler> {\\n\\t\\t\\t\\tBox::new(CodeHandler { lang: \\"cpp\\",\\n\\t\\t\\t\\t                       ..Default::default() })\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\t// TODO:\\n````"},{"path":"support/bindgen/src/lib.rs","start_line":429,"line":437,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\t\\tOk(bindings) => {\\n\\t\\t\\tmatch status.code() {\\n\\t\\t\\t\\tSome(0) => Ok(bindings),\\n\\t\\t\\t\\tSome(2) => Err(std::io::Error::new(std::io::ErrorKind::Other, \\"Rustfmt parsing errors.\\".to_string())),\\n\\t\\t\\t\\tSome(3) => {\\n\\t\\t\\t\\t\\tprintln!(\\"cargo:warning=Rustfmt could not format some lines.\\");\\n\\t\\t\\t\\t\\tOk(bindings)\\n````"},{"path":"support/build/src/assets/mod.rs","start_line":68,"line":96,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\t\\t\\t                                           ..def_options };\\n\\t\\t\\tfs_extra::dir::copy(source, into, &options).map(OpRes::Write)?\\n\\t\\t} else if to_inside {\\n\\t\\t\\tensure_dir_exists(&into, target_root)?;\\n\\t\\t\\tensure_out_of_root(&into)?;\\n\\t\\t\\tlet filename = source.file_name().ok_or_else(|| {\\n\\t\\t\\t\\t                                  IoError::new(\\n\\t\\t\\t\\t                                               IoErrorKind::InvalidFilename,\\n\\t\\t\\t\\t                                               format!(\\"Filename not found for {}\\", into.display()),\\n\\t\\t\\t\\t)\\n\\t\\t\\t                                  })?;\\n\\t\\t\\tlet into = into.join(filename);\\n\\t\\t\\tensure_out_of_root(&into)?;\\n\\t\\t\\tstd::fs::copy(source, into).map(OpRes::Write)?\\n\\t\\t} else {\\n\\t\\t\\tlet into_parent = parent_of(&into)?;\\n\\t\\t\\tensure_dir_exists(into_parent, target_root)?;\\n\\t\\t\\tensure_out_of_root(into_parent)?;\\n\\n\\t\\t\\tif !into.try_exists()? || overwrite {\\n\\t\\t\\t\\tstd::fs::copy(source, into).map(OpRes::Write)?\\n\\t\\t\\t} else {\\n\\t\\t\\t\\tOpRes::Skip\\n\\t\\t\\t}\\n\\t\\t};\\n\\t\\tinfo!(\\"  {copied:?} copy: {} <- {}\\", target.display(), source.display());\\n\\t\\tOk(copied)\\n\\t};\\n````"},{"path":"support/build/src/assets/plan.rs","start_line":269,"line":285,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\n\\tpub fn targets(&self) -> impl Iterator<Item = Cow<\'_, Path>> {\\n\\t\\tself.as_inner().iter().flat_map(|mapping| {\\n\\t\\t\\t                      match mapping {\\n\\t\\t\\t\\t                      Mapping::AsIs(inc, ..) => vec![inc.target()].into_iter(),\\n\\t\\t\\t                         Mapping::Into(inc, ..) => vec![inc.target()].into_iter(),\\n\\t\\t\\t                         Mapping::ManyInto { sources, target, .. } => {\\n\\t\\t\\t\\t                         sources.iter()\\n\\t\\t\\t\\t                                .map(|inc| Cow::from(target.join(inc.target())))\\n\\t\\t\\t\\t                                .collect::<Vec<_>>()\\n\\t\\t\\t\\t                                .into_iter()\\n\\t\\t\\t                         },\\n\\t\\t\\t                      }\\n\\t\\t                      })\\n\\t}\\n\\n\\tpub fn serializable_flatten(\\n````"},{"path":"support/build/src/io.rs","start_line":31,"line":38,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\tlet symlink = link.as_ref().is_symlink();\\n\\n\\tif symlink && std::fs::read_link(&link)? == origin.as_ref() {\\n\\t\\treturn Ok(false);\\n\\t}\\n\\n\\tif !existing && !symlink {\\n\\t\\tsoft::link(origin, link).map(|_| true)\\n````"},{"path":"support/build/src/io.rs","start_line":66,"line":73,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\tlet symlink = link.as_ref().is_symlink();\\n\\n\\tif symlink && std::fs::read_link(&link)? == origin.as_ref() {\\n\\t\\treturn Ok(false);\\n\\t}\\n\\n\\tif !existing && !symlink {\\n\\t\\tsoft::link(origin, link).map(|_| true)\\n````"},{"path":"support/device/src/mount/mac.rs","start_line":106,"line":112,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\twhere I: IntoIterator<Item = Device> {\\n\\tlet mut devs = devs.into_iter()\\n\\t                   .filter_map(|dev| {\\n\\t\\t                   dev.info()\\n\\t\\t                      .serial_number()\\n\\t\\t                      .map(ToOwned::to_owned)\\n\\t\\t                      .map(|sn| (dev, sn))\\n\\t                   })\\n\\t                   .collect::<Vec<_>>();\\n\\n````"},{"path":"support/device/src/serial/mod.rs","start_line":28,"line":40,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\t\\tuse serialport::SerialPort;\\n\\n\\t\\tlet port_name = &self.info.port_name;\\n\\t\\tlet name = self.port.as_ref().and_then(|p| {\\n\\t\\t\\t                             p.try_borrow()\\n\\t\\t\\t                              .ok()\\n\\t\\t\\t                              .and_then(|p| p.name().filter(|s| s != port_name))\\n\\t\\t                             });\\n\\n\\t\\twrite!(f, \\"serial:{}\\", name.as_deref().unwrap_or(port_name))\\n\\t}\\n````"},{"path":"support/device/src/usb/mod.rs","start_line":195,"line":210,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\t\\tlet mut errors = Vec::new();\\n\\t\\tlet port = {\\n\\t\\t\\tcrate::serial::discover::ports_for(self).map(|ports| ports.map(Interface::new))?\\n\\t\\t\\t                                        .find_map(|mut port| {\\n\\t\\t\\t\\t                                        // try to open port, we could get an permission error\\n\\t\\t\\t\\t                                        match port.open() {\\n\\t\\t\\t\\t\\t                                        Ok(_) => Some(port),\\n\\t\\t\\t\\t                                           Err(err) => {\\n\\t\\t\\t\\t\\t                                           errors.push(err);\\n\\t\\t\\t\\t\\t                                           None\\n\\t\\t\\t\\t                                           },\\n\\t\\t\\t\\t                                        }\\n\\t\\t\\t                                        })\\n\\t\\t};\\n\\n\\t\\tif let Some(port) = port {\\n````"},{"path":"support/utils/src/toolchain/gcc.rs","start_line":319,"line":333,"start_side":"RIGHT","side":"RIGHT","body":"````suggestion\\n\\t\\t\\t\\tError::Err(err) => err.fmt(f),\\n\\t\\t\\t\\tError::ExitStatusError { cmd, status, stderr } => {\\n\\t\\t\\t\\t\\tlet stderr = std::str::from_utf8(stderr).map(str::trim)\\n\\t\\t\\t\\t\\t                                        .map(|s| format!(\\"with output: {s}\\"))\\n\\t\\t\\t\\t\\t                                        .ok()\\n\\t\\t\\t\\t\\t                                        .unwrap_or'... 533 more characters,
    request: {
      fetch: [AsyncFunction: customFetch],
      hook: [Function: bound bound register]
    }
  }
}

Node.js v20.8.1

I suppose there could be cool to filter suggestions by changed files (as minimum) that can be retrieved somehow or passed by user to some new parameter. Could be great.

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

No branches or pull requests

1 participant