You have to pay them back pro rated. If you leave after 10 months you'd only have to pay back 2/12 of the bonus. At least that was the case when I started at Amazon (admittedly almost a decade ago).
https://www.irs.gov/publications/p525#en_US_2020_publink1000...