GithubImporter: Thread diff notes
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_idis empty- Create a new
discussion_id - Map the
pull_request_comment.idto thediscussion_idcreated on redis (Github original id for the diff note). Example:8 -> f9f509e301c2ff6112a365ca066cda63c183530c, where:-
8is the original github id for the diff note; -
f9f509e301c2ff6112a365ca066cda63c183530cis thediscussion_id;
-
- Create a new
- When the
in_reply_to_idhas 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_idon 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;
- Use the github_id->discussion_id map to find the discussion id related to the
TODO
-
Depends on !71765 (merged)
Screenshots or screen recordings
| Github | 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Kassio Borges

