Handy: It turns out that if you configure GitHub Pages for an APEX domain, they will also gratefully handle www if you set it up as a CNAME for the APEX.
Example: GitHub Pages setup for
example.io (A points to 18.104.22.168), and
www.example.io is a CNAME for example.io. Then GitHub Pages will do a 301 redirect from www to the naked domain.