From 14d9c28776de95fa1aca6d4fa9c2095443729e7d Mon Sep 17 00:00:00 2001 From: Binrui Dong Date: Wed, 12 Apr 2023 19:55:27 +0800 Subject: Improve checkout performance on Windows runners by upgrading @actions/github dependency (#1246) * Improve checkout performance on Windows runners by upgrading @actions/github dependency Re: https://github.com/actions/checkout/issues/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. (https://github.com/actions/toolkit/pull/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 --- src/octokit-provider.ts | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 src/octokit-provider.ts (limited to 'src/octokit-provider.ts') diff --git a/src/octokit-provider.ts b/src/octokit-provider.ts deleted file mode 100644 index 4fb1285..0000000 --- a/src/octokit-provider.ts +++ /dev/null @@ -1,23 +0,0 @@ -import * as github from '@actions/github' -import {Octokit} from '@octokit/rest' -import {getServerApiUrl} from './url-helper' - -// Centralize all Octokit references by re-exporting -export {Octokit} from '@octokit/rest' - -export type OctokitOptions = { - baseUrl?: string - userAgent?: string -} - -export function getOctokit(authToken: string, opts: OctokitOptions) { - const options: Octokit.Options = { - baseUrl: getServerApiUrl(opts.baseUrl) - } - - if (opts.userAgent) { - options.userAgent = opts.userAgent - } - - return new github.GitHub(authToken, options) -} -- cgit v1.2.3