https://www.timesofisrael.com/ovadia-yosef-speaks-against-sabbath-desecration-to-save-non-jewish-lives/amp/
https://ph.yhb.org.il/en/01-27-03/
“Technically, a Jew may not desecrate Shabbat to save a non-Jew, since one may only desecrate Shabbat for the sake of someone who is himself commanded to keep Shabbat. However, in practice, this rule only applies when another non-Jew is present to save his fellow non-Jew. If no other non-Jew is present, one must treat the non-Jew, even if this requires desecrating Shabbat. Since we want non-Jews to save Jews, we must save them as well. Thus, saving a non-Jew’s life is included in the category of piku’aĥ nefesh.”