This is one of the greatest challenges that faces us.
Even if we manage to "heal" the planet and create a proper sustainable way of life for the human race, eventually the sun will stop shining and humans will disappear unless we find a way to create a sustainable life not based on a planet.
Changes in the Sun will occur only in about 10 billion years. I really doubt that humanity will exist that long, considering all factors.