gr2m / octokit-plugin-create-pull-request

Octokit plugin to create a pull request with multiple file changes
MIT License
104 stars 28 forks source link

Do not try creating a fork when current authentication is for an installation #48

Closed gr2m closed 4 years ago

gr2m commented 4 years ago

The problem is that permissions.push is set to false, even when the installation has write access to the repository.

https://github.com/gr2m/octokit-plugin-create-pull-request/blob/a3cabf5c0c36d574146119af6d787c77d80f5b79/src/create-pull-request.ts#L43

Checking for that property is not enough. One way we could check if the current authorization is a user or not is to check for the presence of the X-OAuth-Scopes response header:

X-OAuth-Scopes lists the scopes your token has authorized.

https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/

gr2m commented 4 years ago

fixed via #49