  We report a fully {\it ab-initio} calculation of the temperature dependence
of the electronic band structure of PbTe. We address two main features relevant
for the thermoelectric figure of merit: the temperature variations of the
direct gap and the difference in energies of the two topmost valence band
maxima located at L and $\Sigma$. We account for the energy shift of the
electronic states due to thermal expansion, as well as electron-phonon
interaction computed using the non-adiabatic Allen-Heine-Cardona formalism
within density functional perturbation theory and the local density
approximation. We capture the increase of the direct gap with temperature in
very good agreement with experiment. We also predict that the valence band
maxima at L and $\Sigma$ become aligned at $\sim 600-700$ K. We find that both
thermal expansion and electron-phonon interaction have a considerable effect on
these temperature variations. The Fan-Migdal and Debye-Waller terms are of
almost equal magnitude but have an opposite sign, and the delicate balance of
these terms gives the correct band shifts. The electron-phonon induced
renormalization of the direct gap is produced mostly by high-frequency optical
phonons, while acoustic phonons are also responsible for the alignment of the
valence band maxima at L and $\Sigma$.
