I have a Github Pages website. I am trying to add directory indexing like what you can enable on an apache website.
You'll have to provide a HTML file containing the directory yourself - you can either write (and update) that yourself, or you could write a GitHub action that regenerates the HTML file automatically after each commit. See https://docs.github.com/en/actions for the documentaion and https://docs.github.com/en/actions/quickstart to get started.