That's the dark side of open source. Companies think these projects grow on trees and they use them without paying anything. We need law changes to ensure that open source can be sustainable and companies pay the fair share of revenue they make by using it.
We don't need more laws. There is something called a License Agreement.
However if you publish your stuff on GPL and other permissive licenses you can't really complain about Amazon, Google and Microsoft making millions on your code while you beg for donations on your Github page.