Preheat oven to 200C/180C fan/Gas 6. Boil the diced potato for 8 minutes until just tender. Drain and set aside.
Melt the butter in a pan. Add the onions and cook gently for 10 minutes until soft and sweet. Season well.
Mix the cooked potato, onions and grated cheese together in a bowl.
Unroll the pastry and cut into 4 equal squares. Divide the filling between them, piling it on one half of each square.
Brush the edges with beaten egg, fold over to make a triangle shape and crimp the edges with a fork.
Place on a baking tray, brush with egg wash and bake for 25-30 minutes until golden and puffed.