If you take the Attack action on your turn, you can use a bonus action to try to shove a creature within 5 feel of you with your shield.
It says nothing about actually attacking, just taking the Action. There's even further nuance when you look at when Bonus actions can be taken and how...