MB3 178b: Asking a Gentile to Put out a Fire on Shabbos (334:26)

You can say to a non-Jew: whoever puts out this fire won't lose. Asking a non-Jew directly to put out a fire to save a mezuzah or Sefer Torah. Today with buildings much closer together, it's permissible to put out the fire.

If there is any remote possibility that the fire could be life-threatening it has to be put out.