synclinear.com icon indicating copy to clipboard operation
synclinear.com copied to clipboard

References to issues should be re-written when synced

Open ericallam opened this issue 2 years ago • 3 comments

For example, here is an issue I just created in linear that was synced to GitHub:

CleanShot 2023-07-13 at 20 02 50@2x

That [TR-654] links back to Linear, instead of linking to the synced issue in GitHub. It would be great if those reference links could automatically be rewritten to reference the correct GitHub issue (or if the linear issue references isn't public, then it should just keep the link as is now)

ericallam avatar Jul 13 '23 19:07 ericallam

Interesting! One possible approach:

  • Include a RegEx check-and-replace for Linear ticket refs ("ABC-123" where "ABC" is known at runtime as linearTeamId) in prepareMarkdownContent()
  • Check the DB for a GH issue corresponding to that ticket via the SyncedIssues table where linearIssueId is known
  • For each Regex match, add a GH link if possible
  • Watch out for infinite loops if the content is different on each side

tedspare avatar Jul 13 '23 21:07 tedspare

Is checking that the content is equal the way you prevent infinite loops?

ericallam avatar Jul 14 '23 08:07 ericallam

That's right, at least after SyncLinear's transformations: linearMarkdown === syncLinear(githubMarkdown)

tedspare avatar Jul 14 '23 15:07 tedspare