Can you mix 12/2 and 10/2 wire on a 20 amp circuit?
There is nothing in the code that restricts mixing wire sizes, as long as the smallest wire meets the minimum allowed by ratings of terminations selected from 310.16 and minimum sizes in 240.4.

If fact in commercial work where circuits feed areas that are sometimes 100' or more from an electrical panel it is standard procedure to run those "homeruns" with the next larger size wire to reduce the voltage loss created by resistance of the wire, then the distribution to device locations is done with minimum allowed size.