@@ -4,14 +4,25 @@ import moment from 'moment';
44
55import { createGithubAppAuth , createGithubInstallationAuth , createOctokitClient } from '../github/auth' ;
66import { bootTimeExceeded , listEC2Runners , tag , untag , terminateRunner } from './../aws/runners' ;
7- import { RunnerInfo , RunnerList , RunnerState } from './../aws/runners.d' ;
7+ import { RunnerInfo , RunnerList } from './../aws/runners.d' ;
88import { GhRunners , githubCache } from './cache' ;
99import { ScalingDownConfig , getEvictionStrategy , getIdleRunnerCount } from './scale-down-config' ;
1010import { metricGitHubAppRateLimit } from '../github/rate-limit' ;
1111import { getGitHubEnterpriseApiUrl } from './scale-up' ;
12+ import { GetResponseDataTypeFromEndpointMethod } from '@octokit/types/dist-types/GetResponseTypeFromEndpointMethod' ;
1213
1314const logger = createChildLogger ( 'scale-down' ) ;
1415
16+ type OrgRunnerList = GetResponseDataTypeFromEndpointMethod <
17+ typeof Octokit . prototype . actions . listSelfHostedRunnersForOrg
18+ > ;
19+
20+ type RepoRunnerList = GetResponseDataTypeFromEndpointMethod <
21+ typeof Octokit . prototype . actions . listSelfHostedRunnersForRepo
22+ > ;
23+
24+ // Derive the shape of an individual runner
25+ type RunnerState = ( OrgRunnerList | RepoRunnerList ) [ 'runners' ] [ number ] ;
1526
1627async function getOrCreateOctokit ( runner : RunnerInfo ) : Promise < Octokit > {
1728 const key = runner . owner ;
0 commit comments