Wrong search terms, already found it:
function on_all_status_transitions( $new_status, $old_status, $post ) {
if ( $new_status != $old_status ) {
// A function to perform actions any time any post changes status.
}
}
add_action( 'transition_post_status', 'on_all_status_transitions', 10, 3 );