What happens if someone else uploads my code to github?
What happens if proprietary code is uploaded to github?
What happens if national secrets are posted to github?
In all of those cases, the person doing the upload does not "own" the content, nor did they choose the license.
There is no reasonable read of a ToS agreement that would allow Microsoft/Github extra rights to that content.
https://docs.github.com/en/site-policy/github-terms/github-t...
Chapter D4 gives microsoft the right to: parse it into a search index or otherwise analyze it on our servers
I don't know what a real court says, but I can imagine a lawyer saying training an AI is done by analyzing your code.
Chapter D5 gives almost anybody right to do a lot with your code, including creating derived works, as long as it happens on github. If the AI training happens on their servers, I think you agreed to them training an AI.
Not saying they are doing it right now based on that document. But I do assume a lawyer has enough material to make the waters really muddy, and a trial being decide by basically a dice roll.