Sanhedrin8: 6
הַבָּא בַמַּחְתֶּרֶת נִדּוֹן עַל שֵׁם סוֹפוֹ. הָיָה בָא בַמַּחְתֶּרֶת וְשָׁבַר אֶת הֶחָבִית, אִם יֶשׁ לוֹ דָמִים, חַיָּב; אִם אֵין לוֹ דָמִים, פָּטוּר.
One who enters through a tunnel is judged according to the eventual outcome. [If] he was coming through a tunnel and he broke a barrel, if his blood is accountable, he is liable; if his blood is not accountable, he is exempt.
Sanhedrin8: 7
וְאֵלּוּ הֵן שֶׁמַּצִּילִין אוֹתָן בְּנַפְשָׁן: הָרוֹדֵף אַחַר חֲבֵרוֹ לְהָרְגוֹ, אַחַר הַזְּכוּר, וְאַחַר הַנַּעֲרָה הַמְאֹרָסָה. אֲבָל הָרוֹדֵף אַחַר הַבְּהֵמָה, וְהַמְחַלֵּל אֶת הַשַּׁבָּת, וְהָעוֹבֵד עֲבוֹדָה זָרָה אֵין מַצִּילִין אוֹתָן בְּנַפְשָׁן.
These are those who are saved at the cost of their lives: one who pursues another to kill him, [or who pursues] a male, or a betrothed naarah. However, one who pursues a beast, and one who desecrates the Sabbath, and one who engages in idola-try are not saved at the cost of their lives.