Master switch OFF
Don't forget to fly the plane
Extinguish the fire if possible, prevent spread
Communicate with handheld radio or telephone
Severity of the problem might dictate an immediate off-airport landing.
I've had a few batteries short out on me but never a fire. Once a flap motor had been cannibalized and replaced with a clapped out one making flap operation five times slower and almost causing a fire. Luckily it hadn't.