First as a side note, you can probably write an applescript to switch WIFI on/off. Since you can code and use terminal, just execute the script before/after. Just make sure WIFI is above Ethernet in
System Preferences -> Network, so the system will use WIFI when both are available.
Besides that, you can use WIFI interface like a proxy. In this case, make sure Ethernet is ranked higher, so all traffic goes through Ethernet by default. An app/shell with configurable proxy setting can direct its traffic /-only to the internal IP address/LAN address of WIFI.
Drawback is that your shell may not support proxy and requires a new program.
I know this works because I have a similar setup with WIFI and VPN. Most of my traffic goes through WIFI, while a special/separate Firefox is pointed at VPN. This way I can access university’s library at will, without compromising privacy or ease of use.
you should be able to set a proxy on this wifi network and or set an exit node that you use for github and ONLY use it for GH much like a VPN (but only need to uncheck use this connection for network resources (aka if its on local lan its NOT used).