Compare what you end up with if you repair the car with what you get if you sell it as it is now.
Private-party value in good running order. Kelley Blue Book or Edmunds will tell you.
A trade-in or instant-offer quote, or a private sale with the problem disclosed.
From your shop, or the cost table on your code page.
Tires, brakes, anything else you know is coming.
This compares money only. A car you know well, that has been reliable apart from this repair, can be worth keeping even when the numbers are close.