If you do try it, whistle first. That will make the groundhog stand up and give you a better shot. If you can spine them (up high, near the brain stem), that is usually the most effective. Head shots can lead to a lot of noise and thrashing. Shoot them in the heart or lungs, and they will run to ground and die in their burrow.
I have tried a variety of .22 rounds on groundhogs, and most did not produce clean kills, even with good shot placement. Only with CCI stingers were they consistently dead-right-there. Even ordinary hollow points were iffy. I would be leery of using a pellet gun.