What should I do if I was already taxed in a foreign country

I worked for the US employer before June, and then worked in a foreign country since June (I'm the employee of the foreign company).

I'm a US resident, but I was outside the country since June for the work in the foreign country.

I have W-2 before June and I was taxed in the foreign country after that (no W-2, just a statement).

Which form should I fill? How could I avoid being taxed again in the US?

Thanks.