We have boxes that Tree Swallows use to nest in. This bird was checking the box for suitability.
The box has a 'Sparrow Spooker' (nylon line attached securely with hook-eyes on top and around the entrance) that protects eggs and babies of Tree Swallows from House Sparrows who cannot negotiate the lines. House Sparrows destroy eggs and baby birds in other species' nests.