Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ async function getGithubRunnerRegistrationToken(githubRunnerConfig: CreateGitHub
repo: githubRunnerConfig.runnerOwner.split('/')[1],
});

metricGitHubAppRateLimit(registrationToken.headers, githubRunnerConfig.appIndex);

return registrationToken.data.token;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { performance } from 'perf_hooks';

import { controlPlaneProviderRegistry } from '../control-plane-providers';
import * as ghAuth from '../github/auth';
import * as rateLimitModule from '../github/rate-limit';
import { createStartRunnerConfig } from './github-runner';
import { publishRetryMessage } from './job-retry';
import * as scaleUpModule from './scale-up';
Expand Down Expand Up @@ -340,6 +341,13 @@ describe('scaleUp with GHES', () => {
expect(mockOctokit.actions.createRegistrationTokenForRepo).not.toBeCalled();
});

it('reports the GitHub App rate limit from the registration token response', async () => {
process.env.ENABLE_EPHEMERAL_RUNNERS = 'false';
const metricSpy = vi.spyOn(rateLimitModule, 'metricGitHubAppRateLimit');
await scaleUpModule.scaleUp(TEST_DATA);
expect(metricSpy).toHaveBeenCalledWith({ 'x-ratelimit-remaining': '4999', 'x-ratelimit-limit': '5000' }, 0);
});

it('creates a runner with labels in a specific group', async () => {
process.env.RUNNER_LABELS = 'label1,label2';
process.env.RUNNER_GROUP_NAME = 'TEST_GROUP';
Expand Down Expand Up @@ -2331,6 +2339,10 @@ function defaultOctokitMockImpl() {
data: {
token: '1234abcd',
},
headers: {
'x-ratelimit-remaining': '4999',
'x-ratelimit-limit': '5000',
},
};
const mockInstallationIdReturnValueOrgs = {
data: {
Expand Down
Loading