If the warning light only comes on in a few situations,
1. low brake fluid switch detects low brake fluid or is shorted
2. the hydraulic brake system has a leak in it somewhere and the pressure differential switch in the combination valve closes its contacts which will trigger the light to come on.
3. you may have a problem with the emergency brake, whether it be slightly engaged and you may not know it, or possibly a switch fault or short.
or sometimes an ABS fault can trigger the light on.
Recommend to check the brake fluid level first, see if its low.
then if its low, i would check the brake system for leaks. If it isnt low then start by checking visual things, make sure no e-brake cables are hung up, and that the e-brake is fully engaging and disengaging.
Then if that does not work, try pumping the brakes see if the light turns on and off.
If that doesnt work, then there may be a electrical problem, be it a switch/sensor or wiring.
Try tapping on the brake fluid reservoir as this can be like coolant level switches, gets stuck in one spot,
Also make sure the pedal pressure is good, and maybe even open a few bleeder screw just to make sure fluid is getting to that part of the hydraulic circuit
Finally check for system fault codes if you have access to a tech 2 scanner.