I said, "Messenger of Allah, what about acts of devotion I used to perform during the days of ignorance, such as freeing slaves and maintaining family ties? Will I be rewarded for them?"The Prophet ﷺ said to him, "You have embraced Islam along with all the good you did before."
حدثنا عبد الرزاق حدثنا معمر عن الزهري عن عروة بن الزبير
قلت يا رسول الله أرأيت أمورا كنت أتحنث بها في الجاهلية من عتاقة وصلة رحم هل لي فيها أجر فقال له النبي ﷺ أسلمت على ما أسلفت من خير
Its isnad is sahih. Bukhari related this hadith (3/301, no. 1436, Fath) in the chapter on zakat, on one who gave charity during shirk then embraced Islam, and Muslim (1/113, no. 123) in the chapter on faith, on the ruling regarding the deeds of a disbeliever when he embraces Islam.