If you upload code to GitHub, you grant them (and every GitHub user) a license to do exactly what Copilot does.
This ToS change happened 2017, and I actually had to get approval from all contributors of my projects to accept to the changed ToS: https://github.com/justjanne/QuasselDroid-ng/issues/5
What GitHub’s doing is shady, but it’s been obvious it was going to happen for years.