Skip to content

GithubImporter: Thread diff notes

Kassio Borges requested to merge kassio/github-importer-thread-diff-notes into master

What does this MR do and why?

Enable threaded diff notes to be migrated as discussions to GitLab.

Related to: #336596 (closed)

Proposed solution

Each diff note is created by Gitlab::GithubImport::Importer::DiffNoteImporter, which fetches the data from Github's List review comments in a repository API. This documentation mentions that each diff note provides a in_reply_to_id, which can be used to create Gitlab discussions.

Implementation details

  • When the in_reply_to_id is empty
    • Create a new discussion_id
    • Map the pull_request_comment.id to the discussion_id created on redis (Github original id for the diff note). Example: 8 -> f9f509e301c2ff6112a365ca066cda63c183530c, where:
      • 8 is the original github id for the diff note;
      • f9f509e301c2ff6112a365ca066cda63c183530c is the discussion_id;
  • When the in_reply_to_id has a value
    • Use the github_id->discussion_id map to find the discussion id related to the in_reply_to_id;
    • Use the found discussion_id on the new diff note;
    • Add another entry to the github_id->discussion_id map to map the new diff note to the discussion_id, like 9 -> f9f509e301c2ff6112a365ca066cda63c183530c;

TODO

Screenshots or screen recordings

Github Gitlab
Update_README_md_by_kassio___Pull_Request__2___anotherkassio_smallrepo Update_README_md___2____Merge_requests___Administrator___gh_1320___GitLab

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Kassio Borges

Merge request reports