Sign reversal of magnetoresistance in a perovskite nickelate by electron doping