-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
@actions/github v3 using Octokit/core #453
Conversation
@@ -0,0 +1,109 @@ | |||
import * as http from 'http' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now load proxy settings when the module is imported because of the way defaults
works. This required a new test suite for proxy tests.
Should we provide a factory method, to help users mock. Might buy us flexibility also (abstraction) instead of inheriting. For example: export function createOctokit(token: string, opts?: OctokitOptions): Octokit {
} Would the types get exported correctly? Would we need to overload to enable custom list of plugins? |
I exported a helper function called
But
|
"@octokit/rest": "^16.43.1" | ||
"@octokit/core": "^2.5.1", | ||
"@octokit/plugin-paginate-rest": "^2.2.0", | ||
"@octokit/plugin-rest-endpoint-methods": "^3.10.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious whether there is a big impact to overall size on disk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There shouldn't be, @octokit/rest imported all 3 of these modules. i'll check but it should be less
…/github dependency (#1246) * Improve checkout performance on Windows runners by upgrading @actions/github dependency Re: #1186 @dscho discovered that the checkout action could stall for a considerable amount of time on Windows runners waiting for PowerShell invocations made from 'windows-release' npm package to complete. Then I studied the dependency chain to figure out where 'windows-release' was imported: '@actions/checkout'@main <- '@actions/github'@2.2.0 <- '@octokit/endpoint'@6.0.1 <- '@octokit/graphql'@4.3.1 <- '@octokit/request'@5.4.2 <- '@octokit/rest'@16.43.1 <- 'universal-user-agent'@4.0.1 <- 'os-name'@3.1.0 <- 'windows-release'@3.1.0 'universal-user-agent' package dropped its dependency on 'os-name' in https://github.com/gr2m/universal-user-agent/releases/tag/v6.0.0 . '@actions/github' v3 removed dependency on '@octokit/rest'@16.43.1 and allows users to move away from the old 'universal-user-agent' v4. (actions/toolkit#453) This pull request attempts to update the version of '@actions/github' used in the checkout action to avoid importing 'windows-release'. Based on testing in my own repositories, I can see an improvement in reduced wait time between entering the checkout action and git actually starts to do useful work. * Update .licenses * Rebuild index.js
…/github dependency (#1246) * Improve checkout performance on Windows runners by upgrading @actions/github dependency Re: actions/checkout#1186 @dscho discovered that the checkout action could stall for a considerable amount of time on Windows runners waiting for PowerShell invocations made from 'windows-release' npm package to complete. Then I studied the dependency chain to figure out where 'windows-release' was imported: '@actions/checkout'@main <- '@actions/github'@2.2.0 <- '@octokit/endpoint'@6.0.1 <- '@octokit/graphql'@4.3.1 <- '@octokit/request'@5.4.2 <- '@octokit/rest'@16.43.1 <- 'universal-user-agent'@4.0.1 <- 'os-name'@3.1.0 <- 'windows-release'@3.1.0 'universal-user-agent' package dropped its dependency on 'os-name' in https://github.com/gr2m/universal-user-agent/releases/tag/v6.0.0 . '@actions/github' v3 removed dependency on '@octokit/rest'@16.43.1 and allows users to move away from the old 'universal-user-agent' v4. (actions/toolkit#453) This pull request attempts to update the version of '@actions/github' used in the checkout action to avoid importing 'windows-release'. Based on testing in my own repositories, I can see an improvement in reduced wait time between entering the checkout action and git actually starts to do useful work. * Update .licenses * Rebuild index.js
@actions/github is stuck on an older major version of
@octokit/rest
due to the way we extended the class. Let's move away from extending the Octokit class so we don't encounter this again, and move towards the plugin/defaults model all the JS libraries have been using.This allows us to customize the octokit is a variety of ways, and reuse existing plugins easily.
In particular, we currently were using
@octokit/rest
which is just @octokit/core with 3 plugins layered on top:We don't really need the latter, so we can use
@octokit/core
to set up a custom octokit with the paginate and rest endpoint plugins and set sane defaults using environmental variables to automatically handle proxy and GHES url scenarios.We can also choose to implement our own custom plugins as needed going forward, or reuse some of the existing plugins, like GHES api plugins
Why don't we just keep using
@octokit/rest
?The core library is really intended to be used if you are extending the plugin model. Type information does not carry well over multiple exports when using plugins, and this offers far more flexibility (at the cost of having to update more packages)
Resolves #468 , #402