gavinr / github-csv-tools

Import and export GitHub issues via CSV
https://npmjs.com/github-csv-tools
MIT License
669 stars 119 forks source link

Error when exporting and then re-importing #108

Open DavidGriffith opened 1 year ago

DavidGriffith commented 1 year ago

I cloned https://github.com/DavidGriffith/frotz, then made a new repository, https://github.com/DavidGriffith/foobar and pushed my locally-cloned copy of Frotz to foobar. Then I used github-csv-tools to grab a CSV of the issues from Frotz. Then I sent it to foobar. My attempt to import failed because of apparently this:

RequestError [HttpError]: Validation Failed: {"resource":"Issue","code":"missing_field","field":"body"}

I don't know what's really going on, but it seems to me that this message is complaining about a missing field name from the first line of the CSV file.

Pulling all issues:

$ githubCsvTools -t blahblahblah -o DavidGriffith -v -e -r frotz
[@octokit/plugin-throttling] `onAbuseLimit()` is deprecated and will be removed in a future release of `@octokit/plugin-throttling`, please use the `onSecondaryRateLimit` handler instead
Success! check 2023-09-17-21-40-41-issues.csv
❤ ❗ If this project has provided you value, please ⭐ star the repo to show your support: ➡ https://github.com/gavinr/github-csv-tools
$

Now pushing those issues into the foobar repo:

$ githubCsvTools -t blahblahblah -o DavidGriffith -v -r foobar 2023-09-17-21-40-41-issues.csv
[@octokit/plugin-throttling] `onAbuseLimit()` is deprecated and will be removed in a future release of `@octokit/plugin-throttling`, please use the `onSecondaryRateLimit` handler instead
Imported issue: "Hard Drive on Fire!" error message 
Imported issue: Sdl tweaks
Error
RequestError [HttpError]: Validation Failed: {"resource":"Issue","code":"missing_field","field":"body"}
    at /usr/local/lib/node_modules/github-csv-tools/node_modules/@octokit/request/dist-node/index.js:122:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Job.doExecute (/usr/local/lib/node_modules/github-csv-tools/node_modules/bottleneck/light.js:405:18) {
  status: 422,
  response: {
    url: 'https://api.github.com/repos/DavidGriffith/foobar/import/issues',
    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': '152',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Mon, 18 Sep 2023 04:45:11 GMT',
      'github-authentication-token-expiration': '2023-10-12 06:50:49 UTC',
      '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-oauth-scopes': '',
      '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': '8DD2:6B0A:10344E:212A09:6507D5D4',
      'x-oauth-scopes': 'repo, workflow',
      'x-ratelimit-limit': '5000',
      'x-ratelimit-remaining': '4994',
      'x-ratelimit-reset': '1695015680',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '6',
      'x-xss-protection': '0'
    },
    data: {
      message: 'Validation Failed',
      errors: [Array],
      documentation_url: 'https://docs.github.com/rest'
    }
  },
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/DavidGriffith/foobar/import/issues',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'github-csv-tools octokit-rest.js/19.0.13 octokit-core.js/4.2.4 Node.js/18.13.0 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"issue":{"title":"Switch to SDL 2","labels":["[]"],"closed":true}}',
    request: { hook: [Function: bound bound register] }
  }
}