You don't think Milley thought his actions were legal? And justifiable?
I'm not sure which actions you are referencing.
There is a report that Milley secretly contacted the Red Chinese and told them he would let them know in advance of any military action the U.S. was taking against them.
Further, it is reported the Commander-In-Chief did not know of Milley’s commitment to the Red Chinese.
If Milley thought his actions were legal and proper I don't see why he would keep them secret. Milley could have locked-in the covenant by announcing it publicly. But maybe not.
For some reason, Milley wanted our nuclear-armed adversaries to have more knowledge about the status or U.S. forces than his own countrymen.