Believe it is the Hatch Act that covers this.
KYPD
As a matter of fact, the Hatch Act has been amended to cut out a lot of partisan political activity. Of course the severity of the punishment for violation will be determined on a case by case basis.