Get your taxes done using TurboTax

If they paid the bonus in 2017, they are not supposed to issue a corrected 2017 W-2 to remove the bonus.  If they do issue a corrected W-2 for 2017, you simply file an amended 2017 return and if the income is lower, you will owe less tax and get a refund of the excess you paid last year.

If you repaid the bonus in 2018, they could also adjust your 2018 W-2 to reflect that fact -- essentially, deducting the bonus repayment from your final paychecks.  In that case, your 2018 W-2 would show less income and you would file with that and pay the correct tax and you end up even.

If they leave the 2017 W-2 as-is, and the 2018 W-2 is for your actual salary and does not reflect the repayment, then:
If the repayment is less than $3000 you are out of luck.
If the repayment is more than $3000, there is a special procedure to deduct it from your income or take a credit for the excess tax.

I'm not sure there's much point in going into the details until you know if you will get a corrected 2017 W-2 or if the repayment is deducted from your 2018 W-2.