1

I want to know which of my repos are GitHub page enabled.

Is there any way to do this with API v3 or v4?

I am new to github. Sample code will be very appreciated.

Luk Aron
  • 1,235
  • 11
  • 34

1 Answers1

1

You can use the GitHub API rpeos Pages

The GitHub Pages API retrieves information about your GitHub Pages configuration, and the statuses of your builds.
Information about the site and the builds can only be accessed by authenticated owners, even if the websites are public.

In GitHub Pages API endpoints with a status key in their response, the value can be one of:

  • null: The site has yet to be built.
  • queued: The build has been requested but not yet begun.
  • building:The build is in progress.
  • built: The site has been built.
  • errored: Indicates an error occurred during the build.

You can then force a GitHub Page repository to rebuild, through GitHub Action, if you want.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • so I need to do a for loop, For each of the repo, check the pages endpoint? – Luk Aron Aug 08 '21 at 09:20
  • @LukAron Yes, at least try it for one repository, and see if it matches what you want. You would then be able to use GraphQL (used by GitHub API v4 instead of the curl-based v3), to apply it in one command to all repositories, as [seen in this example](https://gist.github.com/yozlet/e3626b407102b9276fad285f4c1c80ec). In both instances (GitHub API or GraphQL), you can use the GitHub command-line gh: https://cli.github.com/manual/gh_api. – VonC Aug 08 '21 at 10:35