Skip to content
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 67 commits into from
Mar 21, 2019
Merged

Add v3 endpoints (and GitLab support) #255

merged 67 commits into from
Mar 21, 2019

Conversation

eduardoboucas
Copy link
Owner

No description provided.

sukima and others added 30 commits December 22, 2017 23:28
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
Reverts 1db09fd (or bd1cf56 because these commits were cherry picked between branches) and 59bc12c.
Added our site gatsbycentral.com which uses staticman.
This should remove all of the `logger.info()` calls we used to track down #176.
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.
ntsim and others added 16 commits July 23, 2018 00:41
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.
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
@eduardoboucas eduardoboucas temporarily deployed to staticman-dev January 4, 2019 12:31 Inactive
VincentTam added a commit to VincentTam/staticman that referenced this pull request Jan 6, 2019
@eduardoboucas eduardoboucas temporarily deployed to staticman-dev January 12, 2019 15:04 Inactive
@eduardoboucas eduardoboucas temporarily deployed to staticman-dev January 12, 2019 15:05 Inactive
@eduardoboucas eduardoboucas temporarily deployed to staticman-dev January 13, 2019 23:29 Inactive
@eduardoboucas eduardoboucas merged commit 2be29f7 into master Mar 21, 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants