Open soceanainn opened 6 months ago
Name | Link |
---|---|
Latest commit | bbd1f99d701f408c3c7a61a1464bcc2f0ad9bc2c |
Latest deploy log | https://app.netlify.com/sites/demo-staticjscms/deploys/660d268cfc2e7c0008510c9a |
Deploy Preview | https://deploy-preview-1100.demo.staticcms.org |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Name | Link |
---|---|
Latest commit | bbd1f99d701f408c3c7a61a1464bcc2f0ad9bc2c |
Latest deploy log | https://app.netlify.com/sites/staticjscms/deploys/660d268cc351d10008e0e2fc |
Deploy Preview | https://deploy-preview-1100.staticcms.org |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Attention: Patch coverage is 15.38462%
with 22 lines
in your changes are missing coverage. Please review.
Project coverage is 55.79%. Comparing base (
734cecd
) to head (bbd1f99
).
Files | Patch % | Lines |
---|---|---|
...ckages/core/src/backends/github/implementation.tsx | 5.55% | 15 Missing and 2 partials :warning: |
packages/core/src/backends/github/API.ts | 37.50% | 4 Missing and 1 partial :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This change introduces support for Github App tokens. Supporting Github App tokens will allow for custom authentication through e.g. AWS Lambda.
There are essentially two differences when dealing with app tokens:
$.permissions.push
in response (hasWriteAccess
function), this value will never be true for app tokens (even those with appropriate permissions).For (1) we simply bypass the additional permissions check (validating that the repo can be fetched by the app token is probably enough for most cases).
For (2) we need to create a mock user object for use by StaticCMS (discussed below).
This change also aims to eliminate any redundant calls to fetch the user / repo from Github across the API and implementation code, by having at most one call each.
Creating a mock user for app token
Normally we fetch a
GithubUser
object using the Github API user endpoint and use that to represent the user (based on the token obtained through auth page).Github App tokens won't have a user defined for them so we cannot use the user endpoint.Luckily we only seem to use three fields from this object in code:
name
,login
andavatar_url
. We can workaround this issue by setting defaults for those three fields by fetching the app, and usingname
andslug
from response to setname
andlogin
respectively.avatar_url
can be built fromid
in response.