Depends on the license. If it's MIT and you serve the license, no, you are not infringing at all. A trimmed version of MIT for the relevant bits:
Permission is hereby granted [...[ to any person obtaining a copy of this software [..] to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, [...] subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
> are you infringing when you run it
Depends on the license
> are you infringing when you use that file and distribute it somewhere
Depends on the license
----
When copilot gives you code without the license, you can't even know!