Personally, I don't work on open source software. My personal projects are public, free and open source but they are useless to anyone other than for me.
The main reason I publish them publicly is ... I don't know why actually. However, one benefit to public github repositories is I can try out various services that are free for open source projects. This way I have exposure to these services which is nice. Also it is easier to get help from others or ask questions when I get stuck.
In my experience, I've found programmers very helpful as long as I am willing to put in some effort.
Your employment contract could stipulate that any programming done outside official work is owned by the company. A “work for hire” of sorts. Whether these “copyright assignment” clauses are legal depends on your jurisdiction.
That's also something I keep hearing in anecdotes.