Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 4

“Resource not accessible by integration” when requesting GitHub Pages build via REST API

Solved! Go to Solution.

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 trying to trigger a Pages build manually (as it does not trigger directly on check-in by the GitHub App) with the GitHup App authorization 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 API 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)' 
}
3 Replies
Solution
Community Manager
Message 2 of 4

Re: “Resource not accessible by integration” when requesting GitHub Pages build via REST API

Hi @btouellette,

 

Thank you for being here! It seems like you're authenticating using a GitHub App installation access token. It isn't currently possible to request page builds as a GitHub App installation (server-to-server request).

While this endpoint is enabled for GitHub Apps, you'll need to make a user-to-server request to request a page build:

https://developer.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-...

 

Could you give that a try and let us know if that helps?

 

Best,

Your GitHub Community Team


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Copilot Lvl 2
Message 3 of 4

Re: “Resource not accessible by integration” when requesting GitHub Pages build via REST API

Thanks for the info on user-to-server vs server-to-server. This is running as a daily task on a server. I assume user-to-server requests will involve per-session user action (approving access via OAuth URL) so it doesn't look like I'll be able to use the page build endpoint.

 

EDIT: I now have the page build endpoint working by using 'basic' authentication in octokit where I can explicitly specify username/pass for my primary account so the page build is requested using the user account credentials rather than the installation token.

Ground Controller Lvl 1
Message 4 of 4

Re: “Resource not accessible by integration” when requesting GitHub Pages build via REST API

Hi @AndreaGriffiths11,

 

I think I'm having a similar issue, but would love some clarification. I'm trying to create a fork of a repository with installation token access. I'm getting the same error message as listed above.

 

Is creating a fork another request that must be done user-to-server?

 

Lance