"Resource not accessible by integration" when requesting page build


#1

I’m attempting to set up a GitHub App that checks in a new resource file and triggers a GitHub Pages build so that the new resource is available via the site. I’m attempting to trigger a Pages build manually (as it does not trigger directly on check-in by the GitHub App) via this endpoint: https://developer.github.com/v3/repos/pages/#request-a-page-build

I have the file check in working fine with an installation token so the authorization is solid but I am getting “Resource not accessible by integration” back when I attempt to request a new page build.

The GitHub App has access to the repository with permissions (Write access to code, Read and write access to pages) and it appears that the pages build endpoint is enabled for use by GitHub Apps so I’m not clear on why it is returning this error.

This is all being done with @octokit/rest (https://www.npmjs.com/package/@octokit/rest). Using its debug logging I have verified that the URL/method and the accept header are correct.

method: 'post',
  url:
   'https://api.github.com/repos/btouellette/HHHFreshBotRedux/pages/builds',
  headers:
   { accept: 'application/vnd.github.mister-fantastic-preview+json',
     authorization: 'token v1.snip',
     'user-agent': 'octokit.js/15.15.1 Node.js/10.12.0 (Linux 4.9; x64)' }

#2

Discussion continuing on new forums: https://github.community/t5/GitHub-API-Development-and/Resource-not-accessible-by-integration-when-requesting-GitHub/m-p/14027