in src/gh.js [54:87]
async function waitForRunnerRegistered(label) {
const timeoutMinutes = parseInt(config.input.startupTimeoutMinutes) || 5;
const retryIntervalSeconds = parseInt(config.input.startupRetryIntervalSeconds) || 10;
const quietPeriodSeconds = parseInt(config.input.startupQuietPeriodSeconds) || 30;
core.info(`Waiting ${quietPeriodSeconds}s for the AWS EC2 instance to be registered in GitHub as a new self-hosted runner`);
await new Promise((r) => setTimeout(r, quietPeriodSeconds * 1000));
core.info(`Checking every ${retryIntervalSeconds}s if the GitHub self-hosted runner is registered`);
core.info(`The maximum waiting time is ${timeoutMinutes} minutes`);
const startTime = Date.now();
const timeoutMs = timeoutMinutes * 60 * 1000;
return new Promise((resolve, reject) => {
const interval = setInterval(async () => {
const elapsedMs = Date.now() - startTime;
const runner = await getRunner(label);
if (runner && runner.status === 'online') {
core.info(`GitHub self-hosted runner ${runner.name} is registered and ready to use`);
clearInterval(interval);
resolve();
} else if (elapsedMs >= timeoutMs) {
core.error('GitHub self-hosted runner registration error');
clearInterval(interval);
reject(
`A timeout of ${timeoutMinutes} minutes is exceeded. Your AWS EC2 instance was not able to register itself in GitHub as a new self-hosted runner.`,
);
} else {
core.info('Checking...');
}
}, retryIntervalSeconds * 1000);
});
}