The best course of action is difficult to decide without visually inspecting the scene. But presuming that a miss won't endanger the clerk or bystanders outside, the best course of action is to carefully observe the situation and take action only when or if it appears that someone will get hurt.
If I'm in the store with my wife I will want her to exit via the side/rear door if possible while I stay between her and the BG, again if possible. Otherwise we stay out of sight and quiet until he leaves.
One concern I have with many of the responses here is that one must consider the possibility of making a good COM shot and ... nothing happens to the BG except he's startled by the loud noise. Like the owner of my local liquor store who took 2 .38 rounds to the chest and one to the arm, the BG is too focused on "other matters" to realize he's been hit. Double tapping a BG in this scenario and having him whip around and try to empty a pistol at me as he flees the store is not my idea of a fun night.
If I did take action it would because I had to take action now. Thus I'd not shout any warnings at the BG. Fairness plays no part here as I presume he didn't send a prior notice of his robbery attempt.
I'm also amused by some comments people make about "taking cover". One should realize that in most convenience stores there is plenty of concealment but damn little cover. Items on shelves will likely not stop a bullet, nor will the thin fiberboard which usually acts as the divider.
BillCA in CA (Unfortunately)