There is now an option to prevent animated images, like GIFs, from playing automatically. By default, GitHub respects your system level preference to reduce motion. However, you can also disable autoplay entirely in the Accessibility settings. Once disabled, two buttons will let you control animated images: a play/pause button, and a button to open the link of an image.

A screenshot showing the controls of an animated image when autoplay is disabled