-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add v3 endpoints (and GitLab support) #255
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will allow us to add new transforms easier and remove transform logic from the Staticman unit tests and into a separate Transforms test.
Add downcase/upcase and multiple transform support
# Conflicts: # lib/Staticman.js
Added our site gatsbycentral.com which uses staticman.
Some public APIs have been modified to expose their required parameters e.g. `authenticateWithCode(code, clientId, clientSecret)` or renamed in the case of `writeFileAndSendReview()`.
This class does not currently include OAuth authentication code as the authentication API (particularly for OAuth) for the GitHub service class also needs to be considered first.
This commit changes the GitHub class to require authentication credentials via OAuth or a Personal Access Token upon instantiation. The previous API required you to call an authentication method first before calling any of the other methods (which could potentially cause issues). As we will require authentication credentials at instantiation, there is no longer any need to have any authentication methods on the class, with the exception of the `requestOAuthAccessToken` method. This is a static method which *could* be refactored out of the class (to be determined later). Some additional polish in the tests has also been performed.
This commit replaces the deprecated `github` package with `@octokit/rest`. One of the major change is that API response bodies are wrapped under a `data`key (instead of being returned directly). Consequently, a large amount of refactoring was required to get the tests passing. Other changes include: - `user` parameter in API requests has been replaced by `owner`. This is probably to make the semantics more flexible for when it is not a user e.g. an organisation.
The new `gitlab` package uses `request-promise` which causes method name collisions when in the same project as `request-promise-native`. This is due to both of these packages attempting to attach the various Promise methods such as `then`, `catch`, etc. Once one of the `request-promise` implementations has configured `request` it will proceed to error if another implementation tries to attach the same methods again. To avoid any trouble, the default `request-promise` implementation using Bluebird will be used (as it is not possible to set the Promise implementation to be used by the `gitlab` API).
…ig tests This change primarily addresses the Staticman tests. It appears that most Staticman tests had been ignored by accident via an errant `jest.only` and were not actually running. Some of the site config tests were also failing and logging unnecessarily (this is due to a log statement from #176 still remaining in the codebase). The site config test helper `getConfig` has also been refactored to remove the special handling of the `recaptcha.secret`. Upon removal there doesn't seem to have been any notable problems and tests are passing (after some cleanup in relevant areas).
This commit abstracts some of the raw GitHub API calls being made - `getCurrentUser`, `deleteBranch` and `getReview` into the service class so that they can be generalised for GitLab as well. Notably, the `handlePR` controller current has some weird coding around how it handles the received webhook event from GitHub. Specifically, it seems that it would be easier to just delete the branch immediately upon receiving the webhook, rather than retrieving the PR and *then* deleting the branch. This requires more content before a refactor can be performed.
This commit stops credentials e.g. personal access tokens being leaked by the GitLab service class when an error is thrown. This is due to the underlying request errors exposing too many details, particularly from `request-promise`. To solve this, we just re-wrap errors with a new `ApiError` class which only exposes minimal details.
Fix markdown typo
This commit fixes the test coverage badge on the README being replaced incorrectly when the tests are ran. Previously it would not concatenate the last regex group `)` and break the coverage badge's image URL.
Add GitLab support
fixed convict complaining about `allowedOrigins` not being defined in the schema and GitHub API deprecated users.get and repos.getContent methods.
fix: config schema, deprecated GitHub API methods
Fix errors with tests
This was referenced Jan 4, 2019
VincentTam
added a commit
to VincentTam/staticman
that referenced
this pull request
Jan 6, 2019
caiopavanelli
pushed a commit
to caiopavanelli/staticman
that referenced
this pull request
Aug 17, 2020
…x-fonts Add KaTeX fonts for use with self-hosted option
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.