Github Pages API status: null

Hey all, I am using the Github Rest API from within an Action to handle some stuff with Github Pages.

I hit the pages endpoint with a POST https://api.github.com/repos/[org:redacted]/[repo:redacted]/pages and the branch it should use and that works a treat. This is the data I send in the body:

{"source":{"branch":"[branchname:redacted]"}}

The settings page shows the url, the branch I’ve sent and that it is ready to be published.

I then commit and push to the branch that Pages is set to read from and sometimes this invokes a build and sometimes it doesn’t. It seems totally random.

The one thing I have noticed is that the times it doesn’t work, if I hit the 'GET https://api.github.com/repos/[org]/[repo]/pages` endpoint it returns that status is null:

{
  "url": "https://api.github.com/repos/[org:redacted]/[repo:redacted]/pages",
  "status": null,
  "cname": null,
  "custom_404": false,
  "html_url": "https://[subdomain:redacted].pages.github.io/",
  "source": {
    "branch": "[branch:redacted]",
    "path": "/"
  },
  "public": false,
  "protected_domain_state": null,
  "pending_domain_unverified_at": null,
  "https_enforced": true
}

Has anyone seen this before, does anyone know why? It is completely sporadic and remains as null until I set the branch to None and start again. Sometimes this will fix it, sometimes it won’t.

Any help would be massively appreciated.

Thanks in advance